|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.Classifier
weka.classifiers.trees.REPTree
Fast decision tree learner. Builds a decision/regression tree using information gain/variance reduction and prunes it using reduced-error pruning (with backfitting). Only sorts values for numeric attributes once. Missing values are dealt with by splitting the corresponding instances into pieces (i.e. as in C4.5). Valid options are:
-M number
Set minimum number of instances per leaf (default 2).
-V number
Set minimum numeric class variance proportion of train variance for
split (default 1e-3).
-N number
Number of folds for reduced error pruning (default 3).
-S number
Seed for random data shuffling (default 1).
-P
No pruning.
-T
Maximum tree depth (default -1, no maximum).
Nested Class Summary | |
protected class |
REPTree.Tree
An inner class for building and storing the tree structure |
Field Summary | |
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 |
private static long |
PRINTED_NODES
For getting a unique ID when outputting the tree source (hashcode isn't guaranteed unique) |
Fields inherited from class weka.classifiers.Classifier |
m_Debug |
Fields inherited from interface weka.core.Drawable |
BayesNet, NOT_DRAWABLE, TREE |
Constructor Summary | |
REPTree()
|
Method Summary | |
void |
buildClassifier(Instances data)
Builds classifier. |
double[] |
distributionForInstance(Instance instance)
Computes class distribution of an instance using the tree. |
java.util.Enumeration |
enumerateMeasures()
Returns an enumeration of the additional measure names. |
int |
getMaxDepth()
Get the value of MaxDepth. |
double |
getMeasure(java.lang.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. |
java.lang.String[] |
getOptions()
Gets options from this classifier. |
int |
getSeed()
Get the value of Seed. |
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.util.Enumeration |
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 |
java.lang.String |
numFoldsTipText()
Returns the tip text for this property |
int |
numNodes()
Computes size of the tree. |
protected static void |
resetID()
|
java.lang.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(java.lang.String[] options)
Parses a given list of options. |
void |
setSeed(int newSeed)
Set the value of Seed. |
java.lang.String |
toSource(java.lang.String className)
Returns the tree as if-then statements. |
java.lang.String |
toString()
Outputs the decision tree. |
Methods inherited from class weka.classifiers.Classifier |
classifyInstance, debugTipText, forName, getDebug, makeCopies, setDebug |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
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
private static long PRINTED_NODES
Constructor Detail |
public REPTree()
Method Detail |
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()
public void setSeed(int newSeed)
newSeed
- 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.util.Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class Classifier
public java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class Classifier
public void setOptions(java.lang.String[] options) throws java.lang.Exception
setOptions
in interface OptionHandler
setOptions
in class Classifier
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic int numNodes()
public java.util.Enumeration enumerateMeasures()
enumerateMeasures
in interface AdditionalMeasureProducer
public double getMeasure(java.lang.String additionalMeasureName)
getMeasure
in interface AdditionalMeasureProducer
additionalMeasureName
- the name of the measure to query for its value
java.lang.IllegalArgumentException
- if the named measure is not supportedpublic void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier
in class Classifier
data
- set of instances serving as training data
java.lang.Exception
- if the classifier has not been
generated successfullypublic double[] distributionForInstance(Instance instance) throws java.lang.Exception
distributionForInstance
in class Classifier
instance
- the instance to be classified
java.lang.Exception
- if distribution could not be
computed successfullyprotected static long nextID()
protected static void resetID()
public java.lang.String toSource(java.lang.String className) throws java.lang.Exception
toSource
in interface Sourcable
className
- the name that should be given to the source class.
java.lang.Exception
- if something goes wrongpublic int graphType()
graphType
in interface Drawable
public java.lang.String graph() throws java.lang.Exception
graph
in interface Drawable
java.lang.Exception
- if the graph can't be computedpublic java.lang.String toString()
public static void main(java.lang.String[] argv)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |