public class REPTree extends AbstractClassifier implements OptionHandler, WeightedInstancesHandler, Drawable, AdditionalMeasureProducer, Sourcable, PartitionGenerator, Randomizable
-M <minimum number of instances> Set minimum number of instances per leaf (default 2).
-V <minimum variance for split> Set minimum numeric class variance proportion of train variance for split (default 1e-3).
-N <number of folds> Number of folds for reduced error pruning (default 3).
-S <seed> Seed for random data shuffling (default 1).
-P No pruning.
-L Maximum tree depth (default -1, no maximum)
| Modifier and Type | Class and Description |
|---|---|
protected class |
REPTree.Tree
An inner class for building and storing the tree structure
|
| Modifier and Type | Field and Description |
|---|---|
protected double |
m_InitialCount
The initial class count
|
protected int |
m_MaxDepth
Upper bound on the tree depth
|
protected double |
m_MinNum
The minimum number of instances per leaf.
|
protected double |
m_MinVarianceProp
The minimum proportion of the total variance (over all the data) required for split.
|
protected boolean |
m_NoPruning
Don't prune
|
protected int |
m_NumFolds
Number of folds for reduced error pruning.
|
protected int |
m_Seed
Seed for random data shuffling.
|
protected boolean |
m_SpreadInitialCount
Whether to spread initial count across all values
|
protected REPTree.Tree |
m_Tree
The Tree object
|
protected ZeroR |
m_zeroR
ZeroR model that is used if no attributes are present.
|
BATCH_SIZE_DEFAULT, m_BatchSize, m_Debug, m_DoNotCheckCapabilities, m_numDecimalPlaces, NUM_DECIMAL_PLACES_DEFAULTBayesNet, Newick, NOT_DRAWABLE, TREE| Constructor and Description |
|---|
REPTree() |
| Modifier and Type | Method and Description |
|---|---|
void |
buildClassifier(Instances data)
Builds classifier.
|
double[] |
distributionForInstance(Instance instance)
Computes class distribution of an instance using the tree.
|
java.util.Enumeration<java.lang.String> |
enumerateMeasures()
Returns an enumeration of the additional measure names.
|
void |
generatePartition(Instances data)
Builds the classifier to generate a partition.
|
Capabilities |
getCapabilities()
Returns default capabilities of the classifier.
|
double |
getInitialCount()
Get the value of InitialCount.
|
int |
getMaxDepth()
Get the value of MaxDepth.
|
double |
getMeasure(java.lang.String additionalMeasureName)
Returns the value of the named measure.
|
double[] |
getMembershipValues(Instance instance)
Computes array that indicates node membership.
|
double |
getMinNum()
Get the value of MinNum.
|
double |
getMinVarianceProp()
Get the value of MinVarianceProp.
|
boolean |
getNoPruning()
Get the value of NoPruning.
|
int |
getNumFolds()
Get the value of NumFolds.
|
java.lang.String[] |
getOptions()
Gets options from this classifier.
|
java.lang.String |
getRevision()
Returns the revision string.
|
int |
getSeed()
Get the value of Seed.
|
boolean |
getSpreadInitialCount()
Get the value of SpreadInitialCount.
|
java.lang.String |
globalInfo()
Returns a string describing classifier
|
java.lang.String |
graph()
Outputs the decision tree as a graph
|
int |
graphType()
Returns the type of graph this classifier represents.
|
java.lang.String |
initialCountTipText()
Returns the tip text for this property
|
java.util.Enumeration<Option> |
listOptions()
Lists the command-line options for this classifier.
|
static void |
main(java.lang.String[] argv)
Main method for this class.
|
java.lang.String |
maxDepthTipText()
Returns the tip text for this property
|
java.lang.String |
minNumTipText()
Returns the tip text for this property
|
java.lang.String |
minVariancePropTipText()
Returns the tip text for this property
|
protected static long |
nextID()
Gets the next unique node ID.
|
java.lang.String |
noPruningTipText()
Returns the tip text for this property
|
int |
numElements()
Returns the number of elements in the partition.
|
java.lang.String |
numFoldsTipText()
Returns the tip text for this property
|
int |
numNodes()
Computes size of the tree.
|
protected static void |
resetID()
resets the counter for the nodes
|
java.lang.String |
seedTipText()
Returns the tip text for this property
|
void |
setInitialCount(double newInitialCount)
Set the value of InitialCount.
|
void |
setMaxDepth(int newMaxDepth)
Set the value of MaxDepth.
|
void |
setMinNum(double newMinNum)
Set the value of MinNum.
|
void |
setMinVarianceProp(double newMinVarianceProp)
Set the value of MinVarianceProp.
|
void |
setNoPruning(boolean newNoPruning)
Set the value of NoPruning.
|
void |
setNumFolds(int newNumFolds)
Set the value of NumFolds.
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setSeed(int newSeed)
Set the value of Seed.
|
void |
setSpreadInitialCount(boolean newSpreadInitialCount)
Set the value of SpreadInitialCount.
|
java.lang.String |
spreadInitialCountTipText()
Returns the tip text for this property
|
java.lang.String |
toSource(java.lang.String className)
Returns the tree as if-then statements.
|
java.lang.String |
toString()
Outputs the decision tree.
|
batchSizeTipText, classifyInstance, debugTipText, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, postExecution, preExecution, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlacesprotected ZeroR m_zeroR
protected REPTree.Tree m_Tree
protected int m_NumFolds
protected int m_Seed
protected boolean m_NoPruning
protected double m_MinNum
protected double m_MinVarianceProp
protected int m_MaxDepth
protected double m_InitialCount
protected boolean m_SpreadInitialCount
public java.lang.String globalInfo()
public java.lang.String noPruningTipText()
public boolean getNoPruning()
public void setNoPruning(boolean newNoPruning)
newNoPruning - Value to assign to NoPruning.public java.lang.String minNumTipText()
public double getMinNum()
public void setMinNum(double newMinNum)
newMinNum - Value to assign to MinNum.public java.lang.String minVariancePropTipText()
public double getMinVarianceProp()
public void setMinVarianceProp(double newMinVarianceProp)
newMinVarianceProp - Value to assign to MinVarianceProp.public java.lang.String seedTipText()
public int getSeed()
getSeed in interface Randomizablepublic void setSeed(int newSeed)
setSeed in interface RandomizablenewSeed - Value to assign to Seed.public java.lang.String numFoldsTipText()
public int getNumFolds()
public void setNumFolds(int newNumFolds)
newNumFolds - Value to assign to NumFolds.public java.lang.String maxDepthTipText()
public int getMaxDepth()
public void setMaxDepth(int newMaxDepth)
newMaxDepth - Value to assign to MaxDepth.public java.lang.String initialCountTipText()
public double getInitialCount()
public void setInitialCount(double newInitialCount)
newInitialCount - Value to assign to InitialCount.public java.lang.String spreadInitialCountTipText()
public boolean getSpreadInitialCount()
public void setSpreadInitialCount(boolean newSpreadInitialCount)
newSpreadInitialCount - Value to assign to SpreadInitialCount.public java.util.Enumeration<Option> listOptions()
listOptions in interface OptionHandlerlistOptions in class AbstractClassifierpublic java.lang.String[] getOptions()
getOptions in interface OptionHandlergetOptions in class AbstractClassifierpublic void setOptions(java.lang.String[] options)
throws java.lang.Exception
-M <minimum number of instances> Set minimum number of instances per leaf (default 2).
-V <minimum variance for split> Set minimum numeric class variance proportion of train variance for split (default 1e-3).
-N <number of folds> Number of folds for reduced error pruning (default 3).
-S <seed> Seed for random data shuffling (default 1).
-P No pruning.
-L Maximum tree depth (default -1, no maximum)
setOptions in interface OptionHandlersetOptions in class AbstractClassifieroptions - the list of options as an array of stringsjava.lang.Exception - if an option is not supportedpublic int numNodes()
public java.util.Enumeration<java.lang.String> enumerateMeasures()
enumerateMeasures in interface AdditionalMeasureProducerpublic double getMeasure(java.lang.String additionalMeasureName)
getMeasure in interface AdditionalMeasureProduceradditionalMeasureName - the name of the measure to query for its valuejava.lang.IllegalArgumentException - if the named measure is not supportedpublic Capabilities getCapabilities()
getCapabilities in interface ClassifiergetCapabilities in interface CapabilitiesHandlergetCapabilities in class AbstractClassifierCapabilitiespublic void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier in interface Classifierdata - the data to train withjava.lang.Exception - if building failspublic double[] distributionForInstance(Instance instance) throws java.lang.Exception
distributionForInstance in interface ClassifierdistributionForInstance in class AbstractClassifierinstance - the instance to compute the distribution forjava.lang.Exception - if computation failsprotected static long nextID()
protected static void resetID()
public java.lang.String toSource(java.lang.String className)
throws java.lang.Exception
public int graphType()
public java.lang.String graph()
throws java.lang.Exception
public java.lang.String toString()
toString in class java.lang.Objectpublic void generatePartition(Instances data) throws java.lang.Exception
generatePartition in interface PartitionGeneratorjava.lang.Exceptionpublic double[] getMembershipValues(Instance instance) throws java.lang.Exception
getMembershipValues in interface PartitionGeneratorjava.lang.Exceptionpublic int numElements()
throws java.lang.Exception
numElements in interface PartitionGeneratorjava.lang.Exceptionpublic java.lang.String getRevision()
getRevision in interface RevisionHandlergetRevision in class AbstractClassifierpublic static void main(java.lang.String[] argv)
argv - the commandline options