Package weka.classifiers.rules
Class PART
- java.lang.Object
-
- weka.classifiers.AbstractClassifier
-
- weka.classifiers.rules.PART
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,Classifier,AdditionalMeasureProducer,BatchPredictor,CapabilitiesHandler,CapabilitiesIgnorer,CommandlineRunnable,OptionHandler,RevisionHandler,Summarizable,TechnicalInformationHandler,WeightedInstancesHandler
public class PART extends AbstractClassifier implements OptionHandler, WeightedInstancesHandler, Summarizable, AdditionalMeasureProducer, TechnicalInformationHandler
Class for generating a PART decision list. Uses separate-and-conquer. Builds a partial C4.5 decision tree in each iteration and makes the "best" leaf into a rule.
For more information, see:
Eibe Frank, Ian H. Witten: Generating Accurate Rule Sets Without Global Optimization. In: Fifteenth International Conference on Machine Learning, 144-151, 1998. BibTeX:@inproceedings{Frank1998, author = {Eibe Frank and Ian H. Witten}, booktitle = {Fifteenth International Conference on Machine Learning}, editor = {J. Shavlik}, pages = {144-151}, publisher = {Morgan Kaufmann}, title = {Generating Accurate Rule Sets Without Global Optimization}, year = {1998}, PS = {http://www.cs.waikato.ac.nz/\~eibe/pubs/ML98-57.ps.gz} }Valid options are:-C <pruning confidence> Set confidence threshold for pruning. (default 0.25)
-M <minimum number of objects> Set minimum number of objects per leaf. (default 2)
-R Use reduced error pruning.
-N <number of folds> Set number of folds for reduced error pruning. One fold is used as pruning set. (default 3)
-B Use binary splits only.
-U Generate unpruned decision list.
-J Do not use MDL correction for info gain on numeric attributes.
-Q <seed> Seed for random data shuffling (default 1).
-doNotMakeSplitPointActualValue Do not make split point actual value.
- Version:
- $Revision: 15233 $
- Author:
- Eibe Frank (eibe@cs.waikato.ac.nz)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class weka.classifiers.AbstractClassifier
BATCH_SIZE_DEFAULT, NUM_DECIMAL_PLACES_DEFAULT
-
-
Constructor Summary
Constructors Constructor Description PART()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringbinarySplitsTipText()Returns the tip text for this propertyvoidbuildClassifier(Instances instances)Generates the classifier.doubleclassifyInstance(Instance instance)Classifies an instance.java.lang.StringconfidenceFactorTipText()Returns the tip text for this propertydouble[]distributionForInstance(Instance instance)Returns class probabilities for an instance.java.lang.StringdoNotMakeSplitPointActualValueTipText()Returns the tip text for this propertyjava.util.Enumeration<java.lang.String>enumerateMeasures()Returns an enumeration of the additional measure namesbooleangetBinarySplits()Get the value of binarySplits.CapabilitiesgetCapabilities()Returns default capabilities of the classifier.floatgetConfidenceFactor()Get the value of CF.booleangetDoNotMakeSplitPointActualValue()Gets the value of doNotMakeSplitPointActualValue.doublegetMeasure(java.lang.String additionalMeasureName)Returns the value of the named measureintgetMinNumObj()Get the value of minNumObj.intgetNumFolds()Get the value of numFolds.java.lang.String[]getOptions()Gets the current settings of the Classifier.booleangetReducedErrorPruning()Get the value of reducedErrorPruning.java.lang.StringgetRevision()Returns the revision string.intgetSeed()Get the value of Seed.TechnicalInformationgetTechnicalInformation()Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.booleangetUnpruned()Get the value of unpruned.booleangetUseMDLcorrection()Get the value of useMDLcorrection.java.lang.StringglobalInfo()Returns a string describing classifierjava.util.Enumeration<Option>listOptions()Returns an enumeration describing the available options.static voidmain(java.lang.String[] argv)Main method for testing this class.doublemeasureNumRules()Return the number of rules.java.lang.StringminNumObjTipText()Returns the tip text for this propertyjava.lang.StringnumFoldsTipText()Returns the tip text for this propertyjava.lang.StringreducedErrorPruningTipText()Returns the tip text for this propertyjava.lang.StringseedTipText()Returns the tip text for this propertyvoidsetBinarySplits(boolean v)Set the value of binarySplits.voidsetConfidenceFactor(float v)Set the value of CF.voidsetDoNotMakeSplitPointActualValue(boolean m_doNotMakeSplitPointActualValue)Sets the value of doNotMakeSplitPointActualValue.voidsetMinNumObj(int v)Set the value of minNumObj.voidsetNumFolds(int v)Set the value of numFolds.voidsetOptions(java.lang.String[] options)Parses a given list of options.voidsetReducedErrorPruning(boolean v)Set the value of reducedErrorPruning.voidsetSeed(int newSeed)Set the value of Seed.voidsetUnpruned(boolean newunpruned)Set the value of unpruned.voidsetUseMDLcorrection(boolean newuseMDLcorrection)Set the value of useMDLcorrection.java.lang.StringtoString()Returns a description of the classifierjava.lang.StringtoSummaryString()Returns a superconcise version of the modeljava.lang.StringunprunedTipText()Returns the tip text for this propertyjava.lang.StringuseMDLcorrectionTipText()Returns the tip text for this property-
Methods inherited from class weka.classifiers.AbstractClassifier
batchSizeTipText, debugTipText, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, postExecution, preExecution, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
-
-
-
-
Method Detail
-
globalInfo
public java.lang.String globalInfo()
Returns a string describing classifier- Returns:
- a description suitable for displaying in the explorer/experimenter gui
-
getTechnicalInformation
public TechnicalInformation getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.- Specified by:
getTechnicalInformationin interfaceTechnicalInformationHandler- Returns:
- the technical information about this class
-
getCapabilities
public Capabilities getCapabilities()
Returns default capabilities of the classifier.- Specified by:
getCapabilitiesin interfaceCapabilitiesHandler- Specified by:
getCapabilitiesin interfaceClassifier- Overrides:
getCapabilitiesin classAbstractClassifier- Returns:
- the capabilities of this classifier
- See Also:
Capabilities
-
buildClassifier
public void buildClassifier(Instances instances) throws java.lang.Exception
Generates the classifier.- Specified by:
buildClassifierin interfaceClassifier- Parameters:
instances- the data to train with- Throws:
java.lang.Exception- if classifier can't be built successfully
-
classifyInstance
public double classifyInstance(Instance instance) throws java.lang.Exception
Classifies an instance.- Specified by:
classifyInstancein interfaceClassifier- Overrides:
classifyInstancein classAbstractClassifier- Parameters:
instance- the instance to classify- Returns:
- the classification
- 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.- Specified by:
distributionForInstancein interfaceClassifier- Overrides:
distributionForInstancein classAbstractClassifier- Parameters:
instance- the instance to get the distribution for- Returns:
- the class probabilities
- Throws:
java.lang.Exception- if the distribution can't be computed successfully
-
listOptions
public java.util.Enumeration<Option> 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:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classAbstractClassifier- 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:-C <pruning confidence> Set confidence threshold for pruning. (default 0.25)
-M <minimum number of objects> Set minimum number of objects per leaf. (default 2)
-R Use reduced error pruning.
-N <number of folds> Set number of folds for reduced error pruning. One fold is used as pruning set. (default 3)
-B Use binary splits only.
-U Generate unpruned decision list.
-J Do not use MDL correction for info gain on numeric attributes.
-Q <seed> Seed for random data shuffling (default 1).
-doNotMakeSplitPointActualValue Do not make split point actual value.
- Specified by:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classAbstractClassifier- 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 classAbstractClassifier- Returns:
- an array of strings suitable for passing to setOptions
-
toString
public java.lang.String toString()
Returns a description of the classifier- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of the classifier
-
toSummaryString
public java.lang.String toSummaryString()
Returns a superconcise version of the model- Specified by:
toSummaryStringin interfaceSummarizable- Returns:
- a concise version of the model
-
measureNumRules
public double measureNumRules()
Return the number of rules.- Returns:
- the number of rules
-
enumerateMeasures
public java.util.Enumeration<java.lang.String> 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
-
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.
-
useMDLcorrectionTipText
public java.lang.String useMDLcorrectionTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getUseMDLcorrection
public boolean getUseMDLcorrection()
Get the value of useMDLcorrection.- Returns:
- Value of useMDLcorrection.
-
setUseMDLcorrection
public void setUseMDLcorrection(boolean newuseMDLcorrection)
Set the value of useMDLcorrection.- Parameters:
newuseMDLcorrection- Value to assign to useMDLcorrection.
-
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.
-
doNotMakeSplitPointActualValueTipText
public java.lang.String doNotMakeSplitPointActualValueTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getDoNotMakeSplitPointActualValue
public boolean getDoNotMakeSplitPointActualValue()
Gets the value of doNotMakeSplitPointActualValue.- Returns:
- the value
-
setDoNotMakeSplitPointActualValue
public void setDoNotMakeSplitPointActualValue(boolean m_doNotMakeSplitPointActualValue)
Sets the value of doNotMakeSplitPointActualValue.- Parameters:
m_doNotMakeSplitPointActualValue- the value to set
-
getRevision
public java.lang.String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classAbstractClassifier- Returns:
- the revision
-
main
public static void main(java.lang.String[] argv)
Main method for testing this class.- Parameters:
argv- command line options
-
-