java.lang.Object
adaa.analytics.rules.logic.representation.ruleset.PredictionModel
adaa.analytics.rules.logic.representation.ruleset.RuleSetBase
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ClassificationRuleSet, RegressionRuleSet, SurvivalRuleSet

public abstract class RuleSetBase extends PredictionModel
Abstract class representing all rule-based models (classification/regression/survival).
See Also:
  • Field Details

    • ANNOTATION_TEST_REPORT

      public static final String ANNOTATION_TEST_REPORT
      See Also:
    • attributes

      protected List<String> attributes
      Collection of attributes
    • rules

      protected List<Rule> rules
      Collection of rules.
    • isVoting

      protected boolean isVoting
      Value indicating whether rules are voting.
    • params

      protected InductionParameters params
      Induction paramters.
    • knowledge

      protected Knowledge knowledge
      User's knowledge.
    • totalTime

      protected double totalTime
      Time of constructing the rule set.
    • growingTime

      protected double growingTime
      Time of growing.
    • pruningTime

      protected double pruningTime
      Time of pruning.
  • Constructor Details

    • RuleSetBase

      public RuleSetBase(IExampleSet exampleSet, boolean isVoting, InductionParameters params, Knowledge knowledge)
      Initializes members.
      Parameters:
      exampleSet - Training set.
      isVoting - Voting flag.
      params - Induction parameters.
      knowledge - User's knowledge.
  • Method Details

    • getTotalTime

      public double getTotalTime()
    • setTotalTime

      public void setTotalTime(double v)
    • getGrowingTime

      public double getGrowingTime()
    • setGrowingTime

      public void setGrowingTime(double v)
    • getPruningTime

      public double getPruningTime()
    • setPruningTime

      public void setPruningTime(double v)
    • getIsVoting

      public boolean getIsVoting()
    • setIsVoting

      public void setIsVoting(boolean v)
    • getParams

      public InductionParameters getParams()
      Gets params
    • getRules

      public List<Rule> getRules()
      Gets rules
    • addRule

      public void addRule(Rule v)
      Adds rule to the collection.
      Parameters:
      v - Rule to be added.
    • predict

      public abstract double predict(Example example) throws OperatorException
      Applies the model to a single example and returns the predicted class value.
      Throws:
      OperatorException
    • performPrediction

      public IExampleSet performPrediction(IExampleSet exampleSet, IAttribute predictedLabel) throws OperatorException
      Iterates over all examples and applies the model to them.
      Specified by:
      performPrediction in class PredictionModel
      Throws:
      OperatorException
    • calculateConditionsCount

      public double calculateConditionsCount()
      Calculates number of conditions.
      Returns:
      Number of conditions.
    • calculateInducedCondtionsCount

      public double calculateInducedCondtionsCount()
      Calculates number of induced conditions.
      Returns:
      Number of induced conditions.
    • calculateAvgRuleCoverage

      public double calculateAvgRuleCoverage()
      Calculates average rule coverage.
      Returns:
      Average rule coverage.
    • calculateAvgRulePrecision

      public double calculateAvgRulePrecision()
      Calculates average rule precision.
      Returns:
      Average rule precision.
    • calculateAvgRuleQuality

      public double calculateAvgRuleQuality()
      Calculates average rule quality.
      Returns:
      Average rule quality.
    • calculateSignificance

      public RuleSetBase.Significance calculateSignificance(double alpha)
      Evaluates significance of the rule set.
      Parameters:
      alpha - Significance level.
      Returns:
      Average rules p-value and fraction of rules significant at assumed level.
    • calculateSignificanceFDR

      public RuleSetBase.Significance calculateSignificanceFDR(double alpha)
      Evaluates significance of the rule set with false discovery rate correction.
      Parameters:
      alpha - Significance level.
      Returns:
      Average rules p-value and fraction of rules significant at assumed level.
    • calculateSignificanceFWER

      public RuleSetBase.Significance calculateSignificanceFWER(double alpha)
      Evaluates significance of the rule set with familiy-wise error rate correction.
      Parameters:
      alpha - Significance level.
      Returns:
      Average rules p-value and fraction of rules significant at assumed level.
    • toString

      public String toString()
      Generates text representation of the rule set which contains:

      • induction parameters,
      • user's knowledge (if defined),
      • list of rules,
      • information about coverage of the training set examples.
      Overrides:
      toString in class Object
      Returns:
      Rule set in the text form.
    • toTable

      public String toTable()