|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.Classifier
weka.classifiers.trees.RandomTree
public class RandomTree
Class for constructing a tree that considers K randomly chosen attributes at each node. Performs no pruning. Also has an option to allow estimation of class probabilities based on a hold-out set (backfitting).
Valid options are:-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
Field Summary |
---|
Fields inherited from interface weka.core.Drawable |
---|
BayesNet, NOT_DRAWABLE, TREE |
Constructor Summary | |
---|---|
RandomTree()
|
Method Summary | |
---|---|
java.lang.String |
allowUnclassifiedInstancesTipText()
Returns the tip text for this property |
void |
backfitData(Instances data)
Backfits the given data into the tree. |
void |
buildClassifier(Instances data)
Builds classifier. |
double[] |
distributionForInstance(Instance instance)
Computes class distribution of an instance using the decision tree. |
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 |
getMinNum()
Get the value of MinNum. |
int |
getNumFolds()
Get the value of NumFolds. |
java.lang.String[] |
getOptions()
Gets options from this classifier. |
java.lang.String |
getRevision()
Returns the revision string. |
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 |
java.lang.String |
numFoldsTipText()
Returns the tip text for this property |
int |
numNodes()
Computes size of the tree. |
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 |
toGraph()
Outputs the decision tree as a graph |
int |
toGraph(java.lang.StringBuffer text,
int num)
Outputs one node for graph. |
java.lang.String |
toString()
Outputs the decision tree. |
Methods inherited from class weka.classifiers.Classifier |
---|
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RandomTree()
Method Detail |
---|
public 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 Randomizable
seed
- the seedpublic int getSeed()
getSeed
in interface Randomizable
public 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 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
-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 OptionHandler
setOptions
in class Classifier
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class Classifier
Capabilities
public void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier
in class Classifier
data
- the data to train with
java.lang.Exception
- if something goes wrong or the data doesn't fitpublic void backfitData(Instances data) throws java.lang.Exception
java.lang.Exception
public double[] distributionForInstance(Instance instance) throws java.lang.Exception
distributionForInstance
in class Classifier
instance
- the instance to compute the distribution for
java.lang.Exception
- if computation failspublic java.lang.String toGraph()
public int toGraph(java.lang.StringBuffer text, int num) throws java.lang.Exception
text
- the buffer to append the output tonum
- unique node id
java.lang.Exception
- if generation failspublic java.lang.String toString()
toString
in class java.lang.Object
public int numNodes()
public java.lang.String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class Classifier
public static void main(java.lang.String[] argv)
argv
- the commandline parameterspublic java.lang.String graph() throws java.lang.Exception
graph
in interface Drawable
java.lang.Exception
- if graph can't be computedpublic int graphType()
graphType
in interface Drawable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |