All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.classifiers.rules.Ridor

java.lang.Object
    |
    +----weka.classifiers.Classifier
            |
            +----weka.classifiers.rules.Ridor

public class Ridor
extends Classifier
implements OptionHandler, AdditionalMeasureProducer, WeightedInstancesHandler
The implementation of a RIpple-DOwn Rule learner. It generates the default rule first and then the exceptions for the default rule with the least (weighted) error rate. Then it generates the "best" exceptions for each exception and iterates until pure. Thus it performs a tree-like expansion of exceptions and the leaf has only default rule but no exceptions.
The exceptions are a set of rules that predict the class other than class in default rule. IREP is used to find out the exceptions.

There are five inner classes defined in this class.
The first is Ridor_node, which implements one node in the Ridor tree. It's basically composed of a default class and a set of exception rules to the default class.
The second inner class is RidorRule, which implements a single exception rule using REP.
The last three inner classes are only used in RidorRule. They are Antd, NumericAntd and NominalAntd, which all implement a single antecedent in the RidorRule.
The Antd class is an abstract class, which has two subclasses, NumericAntd and NominalAntd, to implement the corresponding abstract functions. These two subclasses implement the functions related to a antecedent with a nominal attribute and a numeric attribute respectively.

Version:
$Revision: 1.7 $

Constructor Index

 o Ridor()
 

Method Index

 o buildClassifier(Instances)
Builds a ripple-down manner rule learner.
 o classifyInstance(Instance)
Classify the test instance with the rule learner
 o enumerateMeasures()
Returns an enumeration of the additional measure names
 o getFolds()
 
 o getMajorityClass()
 
 o getMeasure(String)
Returns the value of the named measure
 o getMinNo()
 
 o getOptions()
Gets the current settings of the Classifier.
 o getSeed()
 
 o getShuffle()
 
 o getWholeDataErr()
 
 o listOptions()
Returns an enumeration describing the available options Valid options are:

-F number
Set number of folds for reduced error pruning.

 o main(String[])
Main method.
 o setFolds(int)
Set and get members for parameters
 o setMajorityClass(boolean)
 
 o setMinNo(double)
 
 o setOptions(String[])
Parses a given list of options.
 o setSeed(int)
 
 o setShuffle(int)
 
 o setWholeDataErr(boolean)
 
 o toString()
Prints the all the rules of the rule learner.

Constructor Detail

 o Ridor
public Ridor()

Method Detail

 o buildClassifier
public void buildClassifier(Instances instances) throws java.lang.Exception
          Builds a ripple-down manner rule learner.
Parameters:
data - the training data
Throws:
java.lang.Exception - if classifier can't be built successfully
Overrides:
buildClassifier in class Classifier
 o classifyInstance
public double classifyInstance(Instance datum)
          Classify the test instance with the rule learner
Parameters:
instance - the instance to be classified
Returns:
the classification
Overrides:
classifyInstance in class Classifier
 o listOptions
public java.util.Enumeration listOptions()
          Returns an enumeration describing the available options Valid options are:

-F number
Set number of folds for reduced error pruning. One fold is used as the pruning set. (Default: 3)

-S number
Set number of shuffles for randomization. (Default: 10)

-A
Set flag of whether use the error rate of all the data to select the default class in each step. If not set, the learner will only use the error rate in the pruning data

-M
Set flag of whether use the majority class as the default class in each step instead of choosing default class based on the error rate (if the flag is not set)

-N number
Set the minimal weights of instances within a split. (Default: 2)

Returns:
an enumeration of all the available options
 o setOptions
public void setOptions(java.lang.String options[]) throws java.lang.Exception
          Parses a given list of options.
Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an option is not supported
 o getOptions
public java.lang.String[] getOptions()
          Gets the current settings of the Classifier.
Returns:
an array of strings suitable for passing to setOptions
 o setFolds
public void setFolds(int fold)
          Set and get members for parameters
 o getFolds
public int getFolds()
 o setShuffle
public void setShuffle(int sh)
 o getShuffle
public int getShuffle()
 o setSeed
public void setSeed(int s)
 o getSeed
public int getSeed()
 o setWholeDataErr
public void setWholeDataErr(boolean a)
 o getWholeDataErr
public boolean getWholeDataErr()
 o setMajorityClass
public void setMajorityClass(boolean m)
 o getMajorityClass
public boolean getMajorityClass()
 o setMinNo
public void setMinNo(double m)
 o getMinNo
public double getMinNo()
 o enumerateMeasures
public java.util.Enumeration enumerateMeasures()
          Returns an enumeration of the additional measure names
Returns:
an enumeration of the measure names
 o getMeasure
public double getMeasure(java.lang.String additionalMeasureName)
          Returns the value of the named measure
Parameters:
measureName - the name of the measure to query for its value
Returns:
the value of the named measure
Throws:
java.lang.IllegalArgumentException - if the named measure is not supported
 o toString
public java.lang.String toString()
          Prints the all the rules of the rule learner.
Returns:
a textual description of the classifier
Overrides:
toString in class java.lang.Object
 o main
public static void main(java.lang.String args[])
          Main method.
Parameters:
args - the options for the classifier

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home