weka.classifiers.rules
Class PART

java.lang.Object
  extended byweka.classifiers.Classifier
      extended byweka.classifiers.rules.PART
All Implemented Interfaces:
AdditionalMeasureProducer, java.lang.Cloneable, OptionHandler, java.io.Serializable, Summarizable, WeightedInstancesHandler

public class PART
extends Classifier
implements OptionHandler, WeightedInstancesHandler, Summarizable, AdditionalMeasureProducer

Class for generating a PART decision list. For more information, see

Eibe Frank and Ian H. Witten (1998). Generating Accurate Rule Sets Without Global Optimization. In Shavlik, J., ed., Machine Learning: Proceedings of the Fifteenth International Conference, Morgan Kaufmann Publishers, San Francisco, CA.

Valid options are:

-C confidence
Set confidence threshold for pruning. (Default: 0.25)

-M number
Set minimum number of instances per leaf. (Default: 2)

-R
Use reduced error pruning.

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

-B
Use binary splits for nominal attributes.

-U
Generate unpruned decision list.

-Q
The seed for reduced-error pruning.

Version:
$Revision: 1.1 $
Author:
Eibe Frank (eibe@cs.waikato.ac.nz)
See Also:
Serialized Form

Field Summary
private  boolean m_binarySplits
          Binary splits on nominal attributes?
private  float m_CF
          Confidence level
private  int m_minNumObj
          Minimum number of objects
private  int m_numFolds
          Number of folds for reduced error pruning.
private  boolean m_reducedErrorPruning
          Use reduced error pruning?
private  MakeDecList m_root
          The decision list
private  int m_Seed
          The seed for random number generation.
private  boolean m_unpruned
          Generate unpruned list?
 
Fields inherited from class weka.classifiers.Classifier
m_Debug
 
Constructor Summary
PART()
           
 
Method Summary
 java.lang.String binarySplitsTipText()
          Returns the tip text for this property
 void buildClassifier(Instances instances)
          Generates the classifier.
 double classifyInstance(Instance instance)
          Classifies an instance.
 java.lang.String confidenceFactorTipText()
          Returns the tip text for this property
 double[] distributionForInstance(Instance instance)
          Returns class probabilities for an instance.
 java.util.Enumeration enumerateMeasures()
          Returns an enumeration of the additional measure names
 boolean getBinarySplits()
          Get the value of binarySplits.
 float getConfidenceFactor()
          Get the value of CF.
 double getMeasure(java.lang.String additionalMeasureName)
          Returns the value of the named measure
 int getMinNumObj()
          Get the value of minNumObj.
 int getNumFolds()
          Get the value of numFolds.
 java.lang.String[] getOptions()
          Gets the current settings of the Classifier.
 boolean getReducedErrorPruning()
          Get the value of reducedErrorPruning.
 int getSeed()
          Get the value of Seed.
 boolean getUnpruned()
          Get the value of unpruned.
 java.lang.String globalInfo()
          Returns a string describing classifier
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options.
static void main(java.lang.String[] argv)
          Main method for testing this class.
 double measureNumRules()
          Return the number of rules.
 java.lang.String minNumObjTipText()
          Returns the tip text for this property
 java.lang.String numFoldsTipText()
          Returns the tip text for this property
 java.lang.String reducedErrorPruningTipText()
          Returns the tip text for this property
 java.lang.String seedTipText()
          Returns the tip text for this property
 void setBinarySplits(boolean v)
          Set the value of binarySplits.
 void setConfidenceFactor(float v)
          Set the value of CF.
 void setMinNumObj(int v)
          Set the value of minNumObj.
 void setNumFolds(int v)
          Set the value of numFolds.
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 void setReducedErrorPruning(boolean v)
          Set the value of reducedErrorPruning.
 void setSeed(int newSeed)
          Set the value of Seed.
 void setUnpruned(boolean newunpruned)
          Set the value of unpruned.
 java.lang.String toString()
          Returns a description of the classifier
 java.lang.String toSummaryString()
          Returns a superconcise version of the model
 java.lang.String unprunedTipText()
          Returns the tip text for this property
 
Methods inherited from class weka.classifiers.Classifier
debugTipText, forName, getDebug, makeCopies, setDebug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_root

private MakeDecList m_root
The decision list


m_CF

private float m_CF
Confidence level


m_minNumObj

private int m_minNumObj
Minimum number of objects


m_reducedErrorPruning

private boolean m_reducedErrorPruning
Use reduced error pruning?


m_numFolds

private int m_numFolds
Number of folds for reduced error pruning.


m_binarySplits

private boolean m_binarySplits
Binary splits on nominal attributes?


m_unpruned

private boolean m_unpruned
Generate unpruned list?


m_Seed

private int m_Seed
The seed for random number generation.

Constructor Detail

PART

public PART()
Method Detail

globalInfo

public java.lang.String globalInfo()
Returns a string describing classifier

Returns:
a description suitable for displaying in the explorer/experimenter gui

buildClassifier

public void buildClassifier(Instances instances)
                     throws java.lang.Exception
Generates the classifier.

Specified by:
buildClassifier in class Classifier
Parameters:
instances - set of instances serving as training data
Throws:
java.lang.Exception - if classifier can't be built successfully

classifyInstance

public double classifyInstance(Instance instance)
                        throws java.lang.Exception
Classifies an instance.

Overrides:
classifyInstance in class Classifier
Parameters:
instance - the instance to be classified
Returns:
the predicted most likely class for the instance or Instance.missingValue() if no prediction is made
Throws:
java.lang.Exception - if instance can't be classified successfully

distributionForInstance

public final double[] distributionForInstance(Instance instance)
                                       throws java.lang.Exception
Returns class probabilities for an instance.

Overrides:
distributionForInstance in class Classifier
Parameters:
instance - the instance to be classified
Returns:
an array containing the estimated membership probabilities of the test instance in each class or the numeric prediction
Throws:
java.lang.Exception - if the distribution can't be computed successfully

listOptions

public java.util.Enumeration listOptions()
Returns an enumeration describing the available options. Valid options are:

-C confidence
Set confidence threshold for pruning. (Default: 0.25)

-M number
Set minimum number of instances per leaf. (Default: 2)

-R
Use reduced error pruning.

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

-B
Use binary splits for nominal attributes.

-U
Generate unpruned decision list.

-Q
The seed for reduced-error pruning.

Specified by:
listOptions in interface OptionHandler
Overrides:
listOptions in class Classifier
Returns:
an enumeration of all the available options.

setOptions

public void setOptions(java.lang.String[] options)
                throws java.lang.Exception
Parses a given list of options.

Specified by:
setOptions in interface OptionHandler
Overrides:
setOptions in class Classifier
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:
getOptions in interface OptionHandler
Overrides:
getOptions in class Classifier
Returns:
an array of strings suitable for passing to setOptions

toString

public java.lang.String toString()
Returns a description of the classifier


toSummaryString

public java.lang.String toSummaryString()
Returns a superconcise version of the model

Specified by:
toSummaryString in interface Summarizable
Returns:
the object summarized as a string

measureNumRules

public double measureNumRules()
Return the number of rules.

Returns:
the number of rules

enumerateMeasures

public java.util.Enumeration enumerateMeasures()
Returns an enumeration of the additional measure names

Specified by:
enumerateMeasures in interface AdditionalMeasureProducer
Returns:
an enumeration of the measure names

getMeasure

public double getMeasure(java.lang.String additionalMeasureName)
Returns the value of the named measure

Specified by:
getMeasure in interface AdditionalMeasureProducer
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

confidenceFactorTipText

public java.lang.String confidenceFactorTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getConfidenceFactor

public float getConfidenceFactor()
Get the value of CF.

Returns:
Value of CF.

setConfidenceFactor

public void setConfidenceFactor(float v)
Set the value of CF.

Parameters:
v - Value to assign to CF.

minNumObjTipText

public java.lang.String minNumObjTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getMinNumObj

public int getMinNumObj()
Get the value of minNumObj.

Returns:
Value of minNumObj.

setMinNumObj

public void setMinNumObj(int v)
Set the value of minNumObj.

Parameters:
v - Value to assign to minNumObj.

reducedErrorPruningTipText

public java.lang.String reducedErrorPruningTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getReducedErrorPruning

public boolean getReducedErrorPruning()
Get the value of reducedErrorPruning.

Returns:
Value of reducedErrorPruning.

setReducedErrorPruning

public void setReducedErrorPruning(boolean v)
Set the value of reducedErrorPruning.

Parameters:
v - Value to assign to reducedErrorPruning.

unprunedTipText

public java.lang.String unprunedTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getUnpruned

public boolean getUnpruned()
Get the value of unpruned.

Returns:
Value of unpruned.

setUnpruned

public void setUnpruned(boolean newunpruned)
Set the value of unpruned.

Parameters:
newunpruned - Value to assign to unpruned.

numFoldsTipText

public java.lang.String numFoldsTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getNumFolds

public int getNumFolds()
Get the value of numFolds.

Returns:
Value of numFolds.

setNumFolds

public void setNumFolds(int v)
Set the value of numFolds.

Parameters:
v - Value to assign to numFolds.

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

getSeed

public int getSeed()
Get the value of Seed.

Returns:
Value of Seed.

setSeed

public void setSeed(int newSeed)
Set the value of Seed.

Parameters:
newSeed - Value to assign to Seed.

binarySplitsTipText

public java.lang.String binarySplitsTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getBinarySplits

public boolean getBinarySplits()
Get the value of binarySplits.

Returns:
Value of binarySplits.

setBinarySplits

public void setBinarySplits(boolean v)
Set the value of binarySplits.

Parameters:
v - Value to assign to binarySplits.

main

public static void main(java.lang.String[] argv)
Main method for testing this class.