|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weka.classifiers.Classifier | +--weka.classifiers.trees.RandomForest
Class for constructing random forests. For more information see:
Leo Breiman. Random Forests. Machine Learning 45 (1):5-32, October 2001.
Valid options are:
-I num
Set the number of trees in the forest
(default 10)
-K num
Set the number of features to consider.
If < 1 (the default) will use logM+1, where M is the number of inputs.
-S seed
Random number seed (default 1).
Constructor Summary | |
RandomForest()
|
Method Summary | |
void |
buildClassifier(Instances data)
Builds a classifier for a set of instances. |
double[] |
distributionForInstance(Instance instance)
Returns the class probability distribution for an instance. |
java.util.Enumeration |
enumerateMeasures()
Returns an enumeration of the additional measure names. |
double |
getMeasure(java.lang.String additionalMeasureName)
Returns the value of the named measure. |
int |
getNumFeatures()
Get the number of features used in random selection. |
int |
getNumTrees()
Get the value of numTrees. |
java.lang.String[] |
getOptions()
Gets the current settings of the forest. |
int |
getSeed()
Gets the seed for the random number generations |
java.lang.String |
globalInfo()
Returns a string describing classifier |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options. |
static void |
main(java.lang.String[] argv)
Main method for this class. |
double |
measureOutOfBagError()
Gets the out of bag error that was calculated as the classifier was built. |
java.lang.String |
numFeaturesTipText()
Returns the tip text for this property |
java.lang.String |
numTreesTipText()
Returns the tip text for this property |
java.lang.String |
seedTipText()
Returns the tip text for this property |
void |
setNumFeatures(int newNumFeatures)
Set the number of features to use in random selection. |
void |
setNumTrees(int newNumTrees)
Set the value of numTrees. |
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 a description of this classifier. |
Methods inherited from class weka.classifiers.Classifier |
classifyInstance, debugTipText, forName, getDebug, makeCopies, setDebug |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public RandomForest()
Method Detail |
public java.lang.String globalInfo()
public java.lang.String numTreesTipText()
public int getNumTrees()
public void setNumTrees(int newNumTrees)
newNumTrees
- Value to assign to numTrees.public java.lang.String numFeaturesTipText()
public int getNumFeatures()
public void setNumFeatures(int newNumFeatures)
newNumFeatures
- Value to assign to numFeatures.public java.lang.String seedTipText()
public void setSeed(int seed)
setSeed
in interface Randomizable
seed
- the seedpublic int getSeed()
getSeed
in interface Randomizable
public double measureOutOfBagError()
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 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 void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier
in class Classifier
data
- set of instances serving as training data
java.lang.Exception
- if something goes wrongpublic 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 successfullypublic java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] argv)
argv
- the options
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) 2003 David Lindsay, Computer Learning Research Centre, Dept. Computer Science, Royal Holloway, University of London