类 RandomTree
java.lang.Object
weka.classifiers.Classifier
weka.classifiers.trees.RandomTree
- 所有已实现的接口:
Serializable
,Cloneable
,CapabilitiesHandler
,Drawable
,OptionHandler
,Randomizable
,RevisionHandler
,WeightedInstancesHandler
public class RandomTree
extends Classifier
implements OptionHandler, WeightedInstancesHandler, Randomizable, Drawable
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. (default 0) (<0 = int(log_2(#predictors)+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
- 版本:
- $Revision: 10993 $
- 作者:
- Eibe Frank (eibe@cs.waikato.ac.nz), Richard Kirkby (rkirkby@cs.waikato.ac.nz)
- 另请参阅:
-
字段概要
从接口继承的字段 weka.core.Drawable
BayesNet, Newick, NOT_DRAWABLE, TREE
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明Returns the tip text for this propertyvoid
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
Get the value of NumFolds.Returns default capabilities of the classifier.int
Get the value of K.int
Get the maximum depth of trh tree, 0 for unlimited.double[]
getMembershipValues
(Instance instance) Computes array that indicates node membership.double
Get the value of MinNum.int
Get the value of NumFolds.String[]
Gets options from this classifier.int
getSeed()
Gets the seed for the random number generationsReturns a string describing classifiergraph()
Returns graph describing the tree.int
Returns the type of graph this classifier represents.Returns the tip text for this propertyLists the command-line options for this classifier.static void
Main method for this class.Returns the tip text for this propertyReturns the tip text for this propertyint
Returns the number of elements in the partition.Returns the tip text for this propertyReturns the tip text for this propertyvoid
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
(String[] options) Parses a given list of options.void
setSeed
(int seed) Set the seed for random number generation.toString()
Outputs the decision tree.从类继承的方法 weka.classifiers.Classifier
classifyInstance, debugTipText, forName, getDebug, getRevision, makeCopies, makeCopy, setDebug
-
构造器详细资料
-
RandomTree
public RandomTree()
-
-
方法详细资料
-
globalInfo
Returns a string describing classifier- 返回:
- a description suitable for displaying in the explorer/experimenter gui
-
minNumTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getMinNum
public double getMinNum()Get the value of MinNum.- 返回:
- Value of MinNum.
-
setMinNum
public void setMinNum(double newMinNum) Set the value of MinNum.- 参数:
newMinNum
- Value to assign to MinNum.
-
KValueTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getKValue
public int getKValue()Get the value of K.- 返回:
- Value of K.
-
setKValue
public void setKValue(int k) Set the value of K.- 参数:
k
- Value to assign to K.
-
seedTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setSeed
public void setSeed(int seed) Set the seed for random number generation.- 指定者:
setSeed
在接口中Randomizable
- 参数:
seed
- the seed
-
getSeed
public int getSeed()Gets the seed for the random number generations- 指定者:
getSeed
在接口中Randomizable
- 返回:
- the seed for the random number generation
-
maxDepthTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getMaxDepth
public int getMaxDepth()Get the maximum depth of trh tree, 0 for unlimited.- 返回:
- the maximum depth.
-
numFoldsTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getNumFolds
public int getNumFolds()Get the value of NumFolds.- 返回:
- Value of NumFolds.
-
setNumFolds
public void setNumFolds(int newNumFolds) Set the value of NumFolds.- 参数:
newNumFolds
- Value to assign to NumFolds.
-
allowUnclassifiedInstancesTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getAllowUnclassifiedInstances
public boolean getAllowUnclassifiedInstances()Get the value of NumFolds.- 返回:
- Value of NumFolds.
-
setAllowUnclassifiedInstances
public void setAllowUnclassifiedInstances(boolean newAllowUnclassifiedInstances) Set the value of AllowUnclassifiedInstances.- 参数:
newAllowUnclassifiedInstances
- Value to assign to AllowUnclassifiedInstances.
-
setMaxDepth
public void setMaxDepth(int value) Set the maximum depth of the tree, 0 for unlimited.- 参数:
value
- the maximum depth.
-
listOptions
Lists the command-line options for this classifier.- 指定者:
listOptions
在接口中OptionHandler
- 覆盖:
listOptions
在类中Classifier
- 返回:
- an enumeration over all possible options
-
getOptions
Gets options from this classifier.- 指定者:
getOptions
在接口中OptionHandler
- 覆盖:
getOptions
在类中Classifier
- 返回:
- the options for the current setup
-
setOptions
Parses a given list of options. 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
- 指定者:
setOptions
在接口中OptionHandler
- 覆盖:
setOptions
在类中Classifier
- 参数:
options
- the list of options as an array of strings- 抛出:
Exception
- if an option is not supported
-
getCapabilities
Returns default capabilities of the classifier.- 指定者:
getCapabilities
在接口中CapabilitiesHandler
- 覆盖:
getCapabilities
在类中Classifier
- 返回:
- the capabilities of this classifier
- 另请参阅:
-
buildClassifier
Builds classifier.- 指定者:
buildClassifier
在类中Classifier
- 参数:
data
- the data to train with- 抛出:
Exception
- if something goes wrong or the data doesn't fit
-
distributionForInstance
Computes class distribution of an instance using the tree.- 覆盖:
distributionForInstance
在类中Classifier
- 参数:
instance
- the instance to compute the distribution for- 返回:
- the computed class probabilities
- 抛出:
Exception
- if computation fails
-
toString
Outputs the decision tree. -
graph
Returns graph describing the tree. -
graphType
public int graphType()Returns the type of graph this classifier represents. -
generatePartition
Builds the classifier to generate a partition.- 抛出:
Exception
-
getMembershipValues
Computes array that indicates node membership. Array locations are allocated based on breadth-first exploration of the tree.- 抛出:
Exception
-
numElements
Returns the number of elements in the partition.- 抛出:
Exception
-
main
Main method for this class.- 参数:
argv
- the commandline parameters
-