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_DEFAULT
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
|
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.
|
boolean |
getComputeImpurityDecreases()
Get whether to compute/store impurity decreases for variable importance
in RandomForest
|
double[][] |
getImpurityDecreases()
Get the array of impurity decrease/gain sums
|
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 |
setComputeImpurityDecreases(boolean computeImpurityDecreases)
Set whether to compute/store impurity decreases for variable importance
in RandomForest
|
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, setNumDecimalPlaces
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
makeCopy
public java.lang.String globalInfo()
public double[][] getImpurityDecreases()
@ProgrammaticProperty public void setComputeImpurityDecreases(boolean computeImpurityDecreases)
computeImpurityDecreases
- true to compute and store impurity decrease
values for splitting attributespublic boolean getComputeImpurityDecreases()
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 Randomizable
seed
- the seedpublic int getSeed()
getSeed
in interface Randomizable
public 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 OptionHandler
listOptions
in class AbstractClassifier
public java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class AbstractClassifier
public 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 OptionHandler
setOptions
in class AbstractClassifier
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supportedpublic Capabilities getCapabilities()
getCapabilities
in interface Classifier
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class AbstractClassifier
Capabilities
public void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier
in interface Classifier
data
- 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 Classifier
distributionForInstance
in class AbstractClassifier
instance
- the instance to compute the distribution forjava.lang.Exception
- if computation failspublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String graph() throws java.lang.Exception
public int graphType()
public void generatePartition(Instances data) throws java.lang.Exception
generatePartition
in interface PartitionGenerator
java.lang.Exception
public double[] getMembershipValues(Instance instance) throws java.lang.Exception
getMembershipValues
in interface PartitionGenerator
java.lang.Exception
public int numElements() throws java.lang.Exception
numElements
in interface PartitionGenerator
java.lang.Exception
public static void main(java.lang.String[] argv)
argv
- the commandline parameters