Package weka.classifiers.rules
Class Ridor
- java.lang.Object
-
- weka.classifiers.Classifier
-
- weka.classifiers.rules.Ridor
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,AdditionalMeasureProducer,CapabilitiesHandler,OptionHandler,RevisionHandler,WeightedInstancesHandler
public class Ridor extends Classifier implements AdditionalMeasureProducer, WeightedInstancesHandler
An implementation of a RIpple-DOwn Rule learner.
It generates a 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.The exceptions are a set of rules that predict classes other than the default. IREP is used to generate the exceptions.
For more information about Ripple-Down Rules, see:
Brian R. Gaines, Paul Compton (1995). Induction of Ripple-Down Rules Applied to Modeling Large Databases. J. Intell. Inf. Syst.. 5(3):211-228. 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.Valid options are:
-F <number of folds> Set number of folds for IREP One fold is used as pruning set. (default 3)
-S <number of shuffles> Set number of shuffles to randomize the data in order to get better rule. (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 <min. weights> Set the minimal weights of instances within a split. (default 2.0)
- Version:
- $Revision: 5529 $
- Author:
- Xin XU (xx5@cs.waikato.ac.nz)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Ridor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuildClassifier(Instances instances)Builds a ripple-down manner rule learner.doubleclassifyInstance(Instance datum)Classify the test instance with the rule learnerjava.util.EnumerationenumerateMeasures()Returns an enumeration of the additional measure namesjava.lang.StringfoldsTipText()Returns the tip text for this propertyCapabilitiesgetCapabilities()Returns default capabilities of the classifier.intgetFolds()booleangetMajorityClass()doublegetMeasure(java.lang.String additionalMeasureName)Returns the value of the named measuredoublegetMinNo()java.lang.String[]getOptions()Gets the current settings of the Classifier.java.lang.StringgetRevision()Returns the revision string.intgetSeed()intgetShuffle()booleangetWholeDataErr()java.lang.StringglobalInfo()Returns a string describing classifierjava.util.EnumerationlistOptions()Returns an enumeration describing the available options Valid options are:static voidmain(java.lang.String[] args)Main method.java.lang.StringmajorityClassTipText()Returns the tip text for this propertyjava.lang.StringminNoTipText()Returns the tip text for this propertyjava.lang.StringseedTipText()Returns the tip text for this propertyvoidsetFolds(int fold)voidsetMajorityClass(boolean m)voidsetMinNo(double m)voidsetOptions(java.lang.String[] options)Parses a given list of options.voidsetSeed(int s)voidsetShuffle(int sh)voidsetWholeDataErr(boolean a)java.lang.StringshuffleTipText()Returns the tip text for this propertyjava.lang.StringtoString()Prints the all the rules of the rule learner.java.lang.StringwholeDataErrTipText()Returns the tip text for this property-
Methods inherited from class weka.classifiers.Classifier
debugTipText, distributionForInstance, forName, getDebug, makeCopies, makeCopy, setDebug
-
-
-
-
Method Detail
-
globalInfo
public java.lang.String globalInfo()
Returns a string describing classifier- Returns:
- a description suitable for displaying in the explorer/experimenter gui
-
getCapabilities
public Capabilities getCapabilities()
Returns default capabilities of the classifier.- Specified by:
getCapabilitiesin interfaceCapabilitiesHandler- Overrides:
getCapabilitiesin classClassifier- Returns:
- the capabilities of this classifier
- See Also:
Capabilities
-
buildClassifier
public void buildClassifier(Instances instances) throws java.lang.Exception
Builds a ripple-down manner rule learner.- Specified by:
buildClassifierin classClassifier- Parameters:
instances- the training data- Throws:
java.lang.Exception- if classifier can't be built successfully
-
classifyInstance
public double classifyInstance(Instance datum)
Classify the test instance with the rule learner- Overrides:
classifyInstancein classClassifier- Parameters:
datum- the instance to be classified- Returns:
- the classification
-
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)- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classClassifier- Returns:
- an enumeration of all the available options
-
setOptions
public void setOptions(java.lang.String[] options) throws java.lang.ExceptionParses a given list of options. Valid options are:-F <number of folds> Set number of folds for IREP One fold is used as pruning set. (default 3)
-S <number of shuffles> Set number of shuffles to randomize the data in order to get better rule. (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 <min. weights> Set the minimal weights of instances within a split. (default 2.0)
- Specified by:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classClassifier- Parameters:
options- the list of options as an array of strings- Throws:
java.lang.Exception- if an option is not supported
-
getOptions
public java.lang.String[] getOptions()
Gets the current settings of the Classifier.- Specified by:
getOptionsin interfaceOptionHandler- Overrides:
getOptionsin classClassifier- Returns:
- an array of strings suitable for passing to setOptions
-
foldsTipText
public java.lang.String foldsTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setFolds
public void setFolds(int fold)
-
getFolds
public int getFolds()
-
shuffleTipText
public java.lang.String shuffleTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setShuffle
public void setShuffle(int sh)
-
getShuffle
public int getShuffle()
-
seedTipText
public java.lang.String seedTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setSeed
public void setSeed(int s)
-
getSeed
public int getSeed()
-
wholeDataErrTipText
public java.lang.String wholeDataErrTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setWholeDataErr
public void setWholeDataErr(boolean a)
-
getWholeDataErr
public boolean getWholeDataErr()
-
majorityClassTipText
public java.lang.String majorityClassTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setMajorityClass
public void setMajorityClass(boolean m)
-
getMajorityClass
public boolean getMajorityClass()
-
minNoTipText
public java.lang.String minNoTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setMinNo
public void setMinNo(double m)
-
getMinNo
public double getMinNo()
-
enumerateMeasures
public java.util.Enumeration enumerateMeasures()
Returns an enumeration of the additional measure names- Specified by:
enumerateMeasuresin interfaceAdditionalMeasureProducer- Returns:
- an enumeration of the measure names
-
getMeasure
public double getMeasure(java.lang.String additionalMeasureName)
Returns the value of the named measure- Specified by:
getMeasurein interfaceAdditionalMeasureProducer- Parameters:
additionalMeasureName- 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
-
toString
public java.lang.String toString()
Prints the all the rules of the rule learner.- Overrides:
toStringin classjava.lang.Object- Returns:
- a textual description of the classifier
-
getRevision
public java.lang.String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classClassifier- Returns:
- the revision
-
main
public static void main(java.lang.String[] args)
Main method.- Parameters:
args- the options for the classifier
-
-