|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectweka.classifiers.AbstractClassifier
weka.classifiers.trees.RandomForest
public class RandomForest
Class for constructing a forest of random trees.
For more information see:
Leo Breiman (2001). Random Forests. Machine Learning. 45(1):5-32.
@article{Breiman2001,
author = {Leo Breiman},
journal = {Machine Learning},
number = {1},
pages = {5-32},
title = {Random Forests},
volume = {45},
year = {2001}
}
Valid options are:
-I <number of trees> Number of trees to build.
-K <number of features> Number of features to consider (<1=int(logM+1)).
-S Seed for random number generator. (default 1)
-depth <num> The maximum depth of the trees, 0 for unlimited. (default 0)
-num-slots <num> Number of execution slots. (default 1 - i.e. no parallelism)
-D If set, classifier is run in debug mode and may output additional info to the console
| 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. |
Enumeration |
enumerateMeasures()
Returns an enumeration of the additional measure names. |
Capabilities |
getCapabilities()
Returns default capabilities of the classifier. |
int |
getMaxDepth()
Get the maximum depth of trh tree, 0 for unlimited. |
double |
getMeasure(String additionalMeasureName)
Returns the value of the named measure. |
int |
getNumExecutionSlots()
Get the number of execution slots (threads) to use for building the members of the ensemble. |
int |
getNumFeatures()
Get the number of features used in random selection. |
int |
getNumTrees()
Get the value of numTrees. |
String[] |
getOptions()
Gets the current settings of the forest. |
String |
getRevision()
Returns the revision string. |
int |
getSeed()
Gets the seed for the random number generations |
TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on. |
String |
globalInfo()
Returns a string describing classifier |
Enumeration |
listOptions()
Returns an enumeration describing the available options. |
static void |
main(String[] argv)
Main method for this class. |
String |
maxDepthTipText()
Returns the tip text for this property |
double |
measureOutOfBagError()
Gets the out of bag error that was calculated as the classifier was built. |
String |
numExecutionSlotsTipText()
Returns the tip text for this property |
String |
numFeaturesTipText()
Returns the tip text for this property |
String |
numTreesTipText()
Returns the tip text for this property |
String |
seedTipText()
Returns the tip text for this property |
void |
setMaxDepth(int value)
Set the maximum depth of the tree, 0 for unlimited. |
void |
setNumExecutionSlots(int numSlots)
Set the number of execution slots (threads) to use for building the members of the ensemble. |
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(String[] options)
Parses a given list of options. |
void |
setSeed(int seed)
Set the seed for random number generation. |
String |
toString()
Outputs a description of this classifier. |
| Methods inherited from class weka.classifiers.AbstractClassifier |
|---|
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, runClassifier, setDebug |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public RandomForest()
| Method Detail |
|---|
public String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation in interface TechnicalInformationHandlerpublic String numTreesTipText()
public int getNumTrees()
public void setNumTrees(int newNumTrees)
newNumTrees - Value to assign to numTrees.public String numFeaturesTipText()
public int getNumFeatures()
public void setNumFeatures(int newNumFeatures)
newNumFeatures - Value to assign to numFeatures.public String seedTipText()
public void setSeed(int seed)
setSeed in interface Randomizableseed - the seedpublic int getSeed()
getSeed in interface Randomizablepublic String maxDepthTipText()
public int getMaxDepth()
public void setMaxDepth(int value)
value - the maximum depth.public double measureOutOfBagError()
public void setNumExecutionSlots(int numSlots)
numSlots - the number of slots to use.public int getNumExecutionSlots()
public String numExecutionSlotsTipText()
public Enumeration enumerateMeasures()
enumerateMeasures in interface AdditionalMeasureProducerpublic double getMeasure(String additionalMeasureName)
getMeasure in interface AdditionalMeasureProduceradditionalMeasureName - the name of the measure to query for its value
IllegalArgumentException - if the named measure is not supportedpublic Enumeration listOptions()
listOptions in interface OptionHandlerlistOptions in class AbstractClassifierpublic String[] getOptions()
getOptions in interface OptionHandlergetOptions in class AbstractClassifier
public void setOptions(String[] options)
throws Exception
-I <number of trees> Number of trees to build.
-K <number of features> Number of features to consider (<1=int(logM+1)).
-S Seed for random number generator. (default 1)
-depth <num> The maximum depth of the trees, 0 for unlimited. (default 0)
-num-slots <num> Number of execution slots. (default 1 - i.e. no parallelism)
-D If set, classifier is run in debug mode and may output additional info to the console
setOptions in interface OptionHandlersetOptions in class AbstractClassifieroptions - the list of options as an array of strings
Exception - if an option is not supportedpublic Capabilities getCapabilities()
getCapabilities in interface ClassifiergetCapabilities in interface CapabilitiesHandlergetCapabilities in class AbstractClassifierCapabilities
public void buildClassifier(Instances data)
throws Exception
buildClassifier in interface Classifierdata - the instances to train the classifier with
Exception - if something goes wrong
public double[] distributionForInstance(Instance instance)
throws Exception
distributionForInstance in interface ClassifierdistributionForInstance in class AbstractClassifierinstance - the instance to be classified
Exception - if computation failspublic String toString()
toString in class Objectpublic String getRevision()
getRevision in interface RevisionHandlergetRevision in class AbstractClassifierpublic static void main(String[] argv)
argv - the options
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||