public class RandomTree extends AbstractClassifier implements OptionHandler, WeightedInstancesHandler, Randomizable, Drawable, PartitionGenerator
-K <number of attributes> Number of attributes to randomly investigate. (default 0) (<1 = int(log_2(#predictors)+1)).
-M <minimum number of instances> Set minimum number of instances per leaf. (default 1)
-V <minimum variance for split> Set minimum numeric class variance proportion of train variance for split (default 1e-3).
-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.
-B Break ties randomly when several attributes look equally good.
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
-num-decimal-places The number of decimal places for the output of numbers in the model (default 2).
BATCH_SIZE_DEFAULT, NUM_DECIMAL_PLACES_DEFAULTBayesNet, 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
|
java.lang.String |
breakTiesRandomlyTipText()
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()
Gets whether tree is allowed to abstain from making a prediction.
|
boolean |
getBreakTiesRandomly()
Get whether to break ties randomly.
|
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.
|
double |
getMinVarianceProp()
Get the value of MinVarianceProp.
|
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<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
|
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 |
setBreakTiesRandomly(boolean newBreakTiesRandomly)
Set whether to break ties randomly.
|
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 |
setMinVarianceProp(double newMinVarianceProp)
Set the value of MinVarianceProp.
|
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.
|
batchSizeTipText, classifyInstance, debugTipText, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, getRevision, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, postExecution, preExecution, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlacespublic 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 minVariancePropTipText()
public double getMinVarianceProp()
public void setMinVarianceProp(double newMinVarianceProp)
newMinVarianceProp - Value to assign to MinVarianceProp.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 void setMaxDepth(int value)
value - the maximum depth.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 - true if tree is allowed to abstain from making a predictionpublic java.lang.String breakTiesRandomlyTipText()
public boolean getBreakTiesRandomly()
public void setBreakTiesRandomly(boolean newBreakTiesRandomly)
newBreakTiesRandomly - true if ties are to be broken randomlypublic 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
-K <number of attributes> Number of attributes to randomly investigate. (default 0) (<1 = int(log_2(#predictors)+1)).
-M <minimum number of instances> Set minimum number of instances per leaf. (default 1)
-V <minimum variance for split> Set minimum numeric class variance proportion of train variance for split (default 1e-3).
-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.
-B Break ties randomly when several attributes look equally good.
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
-num-decimal-places The number of decimal places for the output of numbers in the model (default 2).
setOptions in interface OptionHandlersetOptions in class AbstractClassifieroptions - the list of options as an array of stringsjava.lang.Exception - if an option 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 something goes wrong or the data doesn't fitpublic 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 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
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 static void main(java.lang.String[] argv)
argv - the commandline parameters