public class RandomTree extends Classifier implements OptionHandler, WeightedInstancesHandler, Randomizable, Drawable
-K <number of attributes> Number of attributes to randomly investigate. (default 0) (<0 = int(log_2(#predictors)+1)).
-M <minimum number of instances> Set minimum number of instances per leaf.
-S <num> Seed for random number generator. (default 1)
-depth <num> The maximum depth of the tree, 0 for unlimited. (default 0)
-N <num> Number of folds for backfitting (default 0, no backfitting).
-U Allow unclassified instances.
-D If set, classifier is run in debug mode and may output additional info to the console
BayesNet, Newick, NOT_DRAWABLE, TREE| Constructor and Description |
|---|
RandomTree() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
allowUnclassifiedInstancesTipText()
Returns the tip text for this property
|
void |
buildClassifier(Instances data)
Builds classifier.
|
double[] |
distributionForInstance(Instance instance)
Computes class distribution of an instance using the tree.
|
void |
generatePartition(Instances data)
Builds the classifier to generate a partition.
|
boolean |
getAllowUnclassifiedInstances()
Get the value of NumFolds.
|
Capabilities |
getCapabilities()
Returns default capabilities of the classifier.
|
int |
getKValue()
Get the value of K.
|
int |
getMaxDepth()
Get the maximum depth of trh tree, 0 for unlimited.
|
double[] |
getMembershipValues(Instance instance)
Computes array that indicates node membership.
|
double |
getMinNum()
Get the value of MinNum.
|
int |
getNumFolds()
Get the value of NumFolds.
|
java.lang.String[] |
getOptions()
Gets options from this classifier.
|
int |
getSeed()
Gets the seed for the random number generations
|
java.lang.String |
globalInfo()
Returns a string describing classifier
|
java.lang.String |
graph()
Returns graph describing the tree.
|
int |
graphType()
Returns the type of graph this classifier represents.
|
java.lang.String |
KValueTipText()
Returns the tip text for this property
|
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
|
int |
numElements()
Returns the number of elements in the partition.
|
java.lang.String |
numFoldsTipText()
Returns the tip text for this property
|
java.lang.String |
seedTipText()
Returns the tip text for this property
|
void |
setAllowUnclassifiedInstances(boolean newAllowUnclassifiedInstances)
Set the value of AllowUnclassifiedInstances.
|
void |
setKValue(int k)
Set the value of K.
|
void |
setMaxDepth(int value)
Set the maximum depth of the tree, 0 for unlimited.
|
void |
setMinNum(double newMinNum)
Set the value of MinNum.
|
void |
setNumFolds(int newNumFolds)
Set the value of NumFolds.
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setSeed(int seed)
Set the seed for random number generation.
|
java.lang.String |
toString()
Outputs the decision tree.
|
classifyInstance, debugTipText, forName, getDebug, getRevision, makeCopies, makeCopy, setDebugpublic java.lang.String globalInfo()
public java.lang.String minNumTipText()
public double getMinNum()
public void setMinNum(double newMinNum)
newMinNum - Value to assign to MinNum.public java.lang.String KValueTipText()
public int getKValue()
public void setKValue(int k)
k - Value to assign to K.public java.lang.String seedTipText()
public void setSeed(int seed)
setSeed in interface Randomizableseed - the seedpublic int getSeed()
getSeed in interface Randomizablepublic java.lang.String maxDepthTipText()
public int getMaxDepth()
public java.lang.String numFoldsTipText()
public int getNumFolds()
public void setNumFolds(int newNumFolds)
newNumFolds - Value to assign to NumFolds.public java.lang.String allowUnclassifiedInstancesTipText()
public boolean getAllowUnclassifiedInstances()
public void setAllowUnclassifiedInstances(boolean newAllowUnclassifiedInstances)
newAllowUnclassifiedInstances - Value to assign to
AllowUnclassifiedInstances.public void setMaxDepth(int value)
value - the maximum depth.public java.util.Enumeration listOptions()
listOptions in interface OptionHandlerlistOptions in class Classifierpublic java.lang.String[] getOptions()
getOptions in interface OptionHandlergetOptions in class Classifierpublic void setOptions(java.lang.String[] options)
throws java.lang.Exception
-K <number of attributes> Number of attributes to randomly investigate (<0 = int(log_2(#attributes)+1)).
-M <minimum number of instances> Set minimum number of instances per leaf.
-S <num> Seed for random number generator. (default 1)
-depth <num> The maximum depth of the tree, 0 for unlimited. (default 0)
-N <num> Number of folds for backfitting (default 0, no backfitting).
-U Allow unclassified instances.
-D If set, classifier is run in debug mode and may output additional info to the console
setOptions in interface OptionHandlersetOptions in class Classifieroptions - the list of options as an array of stringsjava.lang.Exception - if an option is not supportedpublic Capabilities getCapabilities()
getCapabilities in interface CapabilitiesHandlergetCapabilities in class ClassifierCapabilitiespublic void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier in class Classifierdata - the data to train withjava.lang.Exception - if something goes wrong or the data doesn't fitpublic double[] distributionForInstance(Instance instance) throws java.lang.Exception
distributionForInstance in class Classifierinstance - the instance to compute the distribution forjava.lang.Exception - if computation failspublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String graph()
throws java.lang.Exception
public int graphType()
public void generatePartition(Instances data) throws java.lang.Exception
java.lang.Exceptionpublic double[] getMembershipValues(Instance instance) throws java.lang.Exception
java.lang.Exceptionpublic int numElements()
throws java.lang.Exception
java.lang.Exceptionpublic static void main(java.lang.String[] argv)
argv - the commandline parameters