public class REPTree extends Classifier implements OptionHandler, WeightedInstancesHandler, Drawable, AdditionalMeasureProducer, Sourcable
-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 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 REPTree.Tree |
m_Tree
The Tree object
|
protected ZeroR |
m_zeroR
ZeroR model that is used if no attributes are present.
|
m_Debug
BayesNet, 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.
|
Enumeration |
enumerateMeasures()
Returns an enumeration of the additional measure names.
|
Capabilities |
getCapabilities()
Returns default capabilities of the classifier.
|
int |
getMaxDepth()
Get the value of MaxDepth.
|
double |
getMeasure(String additionalMeasureName)
Returns the value of the named measure.
|
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.
|
String[] |
getOptions()
Gets options from this classifier.
|
String |
getRevision()
Returns the revision string.
|
int |
getSeed()
Get the value of Seed.
|
String |
globalInfo()
Returns a string describing classifier
|
String |
graph()
Outputs the decision tree as a graph
|
int |
graphType()
Returns the type of graph this classifier
represents.
|
Enumeration |
listOptions()
Lists the command-line options for this classifier.
|
static void |
main(String[] argv)
Main method for this class.
|
String |
maxDepthTipText()
Returns the tip text for this property
|
String |
minNumTipText()
Returns the tip text for this property
|
String |
minVariancePropTipText()
Returns the tip text for this property
|
protected static long |
nextID()
Gets the next unique node ID.
|
String |
noPruningTipText()
Returns the tip text for this property
|
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
|
String |
seedTipText()
Returns the tip text for this property
|
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(String[] options)
Parses a given list of options.
|
void |
setSeed(int newSeed)
Set the value of Seed.
|
String |
toSource(String className)
Returns the tree as if-then statements.
|
String |
toString()
Outputs the decision tree.
|
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, runClassifier, setDebug
protected 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
public String globalInfo()
public String noPruningTipText()
public boolean getNoPruning()
public void setNoPruning(boolean newNoPruning)
newNoPruning
- Value to assign to NoPruning.public String minNumTipText()
public double getMinNum()
public void setMinNum(double newMinNum)
newMinNum
- Value to assign to MinNum.public String minVariancePropTipText()
public double getMinVarianceProp()
public void setMinVarianceProp(double newMinVarianceProp)
newMinVarianceProp
- Value to assign to MinVarianceProp.public String seedTipText()
public int getSeed()
public void setSeed(int newSeed)
newSeed
- Value to assign to Seed.public String numFoldsTipText()
public int getNumFolds()
public void setNumFolds(int newNumFolds)
newNumFolds
- Value to assign to NumFolds.public String maxDepthTipText()
public int getMaxDepth()
public void setMaxDepth(int newMaxDepth)
newMaxDepth
- Value to assign to MaxDepth.public Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class Classifier
public String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class Classifier
public void setOptions(String[] options) throws 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 OptionHandler
setOptions
in class Classifier
options
- the list of options as an array of stringsException
- if an option is not supportedpublic int numNodes()
public Enumeration enumerateMeasures()
enumerateMeasures
in interface AdditionalMeasureProducer
public double getMeasure(String additionalMeasureName)
getMeasure
in interface AdditionalMeasureProducer
additionalMeasureName
- the name of the measure to query for its valueIllegalArgumentException
- if the named measure is not supportedpublic Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class Classifier
Capabilities
public void buildClassifier(Instances data) throws Exception
buildClassifier
in class Classifier
data
- the data to train withException
- if building failspublic double[] distributionForInstance(Instance instance) throws Exception
distributionForInstance
in class Classifier
instance
- the instance to compute the distribution forException
- if computation failsprotected static long nextID()
protected static void resetID()
public String toSource(String className) throws Exception
public int graphType()
public String toString()
public String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class Classifier
public static void main(String[] argv)
argv
- the commandline optionsCopyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.