weka.classifiers.rules
Class Ridor.Ridor_node

java.lang.Object
  extended byweka.classifiers.rules.Ridor.Ridor_node
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
Ridor

private class Ridor.Ridor_node
extends java.lang.Object
implements java.io.Serializable

Private class implementing the single node of Ridor. It consists of a default class label, a set of exceptions to the default rule and the exceptions to each exception


Field Summary
private  double defClass
          The default class label
private  Ridor.Ridor_node[] excepts
          The exceptions of the exception rules
private  int level
          The level of this node
private  Ridor.RidorRule[] rules
          The set of exceptions of the default rule.
 
Constructor Summary
private Ridor.Ridor_node()
           
 
Method Summary
private  Instances append(Instances data1, Instances data2)
          Private function to combine two data
private  double buildRuleset(Instances insts, double classCount, java.util.Vector ruleset)
          Private function to build a rule set and return the weighted avg of accuracy rate of rules in the set.
private  double computeWeightedAcRt(double worthRt, double cover, double total)
          Compute the weighted average of accuracy rate of a certain rule Each rule is weighted by its coverage proportion in the whole data.
private  Instances[][] divide(Ridor.RidorRule rule, Instances[] dataByClass)
          Builds an array of data according to their true class label Each bag of data is filtered through the rule specified and is totally covered by this rule.
 void findRules(Instances[] dataByClass, int lvl)
          Builds a ripple-down manner rule learner.
 double getDefClass()
          "Get" member functions
 Ridor.Ridor_node[] getExcepts()
           
 Ridor.RidorRule[] getRules()
           
 int size()
          The size of the certain node of Ridor, i.e. the number of rules generated within and below this node
 java.lang.String toString()
          Prints the all the rules of one node of Ridor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

defClass

private double defClass
The default class label


rules

private Ridor.RidorRule[] rules
The set of exceptions of the default rule. Each element also has its own exceptions and the consequent of each rule is determined by its exceptions


excepts

private Ridor.Ridor_node[] excepts
The exceptions of the exception rules


level

private int level
The level of this node

Constructor Detail

Ridor.Ridor_node

private Ridor.Ridor_node()
Method Detail

getDefClass

public double getDefClass()
"Get" member functions


getRules

public Ridor.RidorRule[] getRules()

getExcepts

public Ridor.Ridor_node[] getExcepts()

findRules

public void findRules(Instances[] dataByClass,
                      int lvl)
               throws java.lang.Exception
Builds a ripple-down manner rule learner.

Parameters:
dataByClass - the divided data by their class label. The real class labels of the instances are all set to 0
lvl - the level of the parent node
Throws:
java.lang.Exception - if ruleset of this node cannot be built

buildRuleset

private double buildRuleset(Instances insts,
                            double classCount,
                            java.util.Vector ruleset)
                     throws java.lang.Exception
Private function to build a rule set and return the weighted avg of accuracy rate of rules in the set.

Parameters:
insts - the data used to build ruleset
classCount - the counts of the instances with the predicted class but not yet covered by the ruleset
ruleset - the ruleset to be built
Returns:
the weighted accuracy rate of the ruleset
Throws:
if - the rules cannot be built properly
java.lang.Exception

append

private Instances append(Instances data1,
                         Instances data2)
Private function to combine two data

Parameters:
data1 - the data to which data2 is appended
data2 - the data to be appended to data1
Returns:
the merged data

computeWeightedAcRt

private double computeWeightedAcRt(double worthRt,
                                   double cover,
                                   double total)
Compute the weighted average of accuracy rate of a certain rule Each rule is weighted by its coverage proportion in the whole data. So the accuracy rate of one ruleset is actually (worth rate) * (coverage proportion) coverage of the rule on the whole data where coverage proportion = ----------------------------------------- the whole data size fed into the ruleset

Parameters:
worthRt - the worth rate
cover - the coverage of the rule on the whole data
total - the total data size fed into the ruleset
Returns:
the weighted accuracy rate of this rule

divide

private Instances[][] divide(Ridor.RidorRule rule,
                             Instances[] dataByClass)
Builds an array of data according to their true class label Each bag of data is filtered through the rule specified and is totally covered by this rule. Both the data covered and uncovered by the rule will be returned by the procedure.

Parameters:
rule - the rule covering the data
dataByClass - the array of data to be covered by the rule
Returns:
the arrays of data both covered and not covered by the rule

size

public int size()
The size of the certain node of Ridor, i.e. the number of rules generated within and below this node

Returns:
the size of this node

toString

public java.lang.String toString()
Prints the all the rules of one node of Ridor.

Returns:
a textual description of one node of Ridor