jsat.classifiers.trees
Class ExtraTree
- java.lang.Object
-
- jsat.classifiers.trees.ExtraTree
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Classifier, TreeLearner, Parameterized, Regressor
- Direct Known Subclasses:
- ERTrees
public class ExtraTree extends java.lang.Object implements Classifier, Regressor, TreeLearner, Parameterized
The ExtraTree is an Extremely Randomized Tree. Splits are chosen at random, and the features that are selected are also chosen at random for each new node in the tree.
If set to randomly select one feature for each node, it becomes a Totally Randomized Tree
See:
Geurts, P., Ernst, D.,&Wehenkel, L. (2006). Extremely randomized trees . Machine learning, 63(1), 3–42. doi:10.1007/s10994-006-6226-1- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description ExtraTree()Creates a new Extra Tree that will use all features in the training setExtraTree(ExtraTree toCopy)Copy constructor.ExtraTree(int selectionCount, int stopSize)Creates a new Extra Tree
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description CategoricalResultsclassify(DataPoint data)Performs classification on the given data point.ExtraTreeclone()ImpurityScore.ImpurityMeasuregetImpurityMeasure()Returns the impurity measure in useintgetSelectionCount()Returns the number of random features chosen at each level in the treeintgetStopSize()Returns the stopping size for tree growthTreeNodeVisitorgetTreeNodeVisitor()Obtains a node visitor for the tree learner that can be used to traverse and predict from the learned treebooleanisBinaryCategoricalSplitting()Returns whether or not binary splitting is used for nominal featuresdoubleregress(DataPoint data)voidsetBinaryCategoricalSplitting(boolean binaryCategoricalSplitting)The normal implementation of ExtraTree always produces binary splits, including for categorical features.voidsetImpurityMeasure(ImpurityScore.ImpurityMeasure impurityMeasure)Sets the impurity measure used during classification tree construction to select the best of the features.voidsetSelectionCount(int selectionCount)The ExtraTree will select the best of a random subset of features at each level, this sets the number of random features to select.voidsetStopSize(int stopSize)Sets the stopping size for tree growth.booleansupportsWeightedData()Indicates whether the model knows how to train using weighted data points.voidtrain(ClassificationDataSet dataSet, boolean parallel)Trains the classifier and constructs a model for classification using the given data set.voidtrain(RegressionDataSet dataSet)voidtrain(RegressionDataSet dataSet, boolean parallel)-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jsat.classifiers.Classifier
train
-
Methods inherited from interface jsat.parameters.Parameterized
getParameter, getParameters
-
-
-
-
Constructor Detail
-
ExtraTree
public ExtraTree()
Creates a new Extra Tree that will use all features in the training set
-
ExtraTree
public ExtraTree(int selectionCount, int stopSize)Creates a new Extra Tree- Parameters:
selectionCount- the number of features to selectstopSize- the stop size
-
ExtraTree
public ExtraTree(ExtraTree toCopy)
Copy constructor.- Parameters:
toCopy- the object to copy
-
-
Method Detail
-
setImpurityMeasure
public void setImpurityMeasure(ImpurityScore.ImpurityMeasure impurityMeasure)
Sets the impurity measure used during classification tree construction to select the best of the features.- Parameters:
impurityMeasure- the impurity measure to use
-
getImpurityMeasure
public ImpurityScore.ImpurityMeasure getImpurityMeasure()
Returns the impurity measure in use- Returns:
- the impurity measure in use
-
setStopSize
public void setStopSize(int stopSize)
Sets the stopping size for tree growth. When a node has less than or equal to stopSize data points to train from, it terminates and produces a leaf node.- Parameters:
stopSize- the size of the testing set to refuse to split
-
getStopSize
public int getStopSize()
Returns the stopping size for tree growth- Returns:
- the stopping size for tree growth
-
setSelectionCount
public void setSelectionCount(int selectionCount)
The ExtraTree will select the best of a random subset of features at each level, this sets the number of random features to select. If set larger than the number of features in the training set, all features will be eligible for selection at every level.- Parameters:
selectionCount- the number of random features to select
-
getSelectionCount
public int getSelectionCount()
Returns the number of random features chosen at each level in the tree- Returns:
- the number of random features to chose
-
setBinaryCategoricalSplitting
public void setBinaryCategoricalSplitting(boolean binaryCategoricalSplitting)
The normal implementation of ExtraTree always produces binary splits, including for categorical features. If set to false categorical features will expand out for each value in the category. This reduces the randomness of the tree.- Parameters:
binaryCategoricalSplitting- whether or not to use the original splitting algorithm, or to fully expand nominal features
-
isBinaryCategoricalSplitting
public boolean isBinaryCategoricalSplitting()
Returns whether or not binary splitting is used for nominal features- Returns:
- whether or not binary splitting is used for nominal features
-
classify
public CategoricalResults classify(DataPoint data)
Description copied from interface:ClassifierPerforms classification on the given data point.- Specified by:
classifyin interfaceClassifier- Parameters:
data- the data point to classify- Returns:
- the results of the classification.
-
train
public void train(ClassificationDataSet dataSet, boolean parallel)
Description copied from interface:ClassifierTrains the classifier and constructs a model for classification using the given data set. If the training method knows how, it will used the threadPool to conduct training in parallel. This method will block until the training has completed.- Specified by:
trainin interfaceClassifier- Parameters:
dataSet- the data set to train onparallel-trueif multiple threads should be used to train the model.falseif it should be done in a single threaded manner.
-
supportsWeightedData
public boolean supportsWeightedData()
Description copied from interface:ClassifierIndicates whether the model knows how to train using weighted data points. If it does, the model will train assuming the weights. The values returned by this method may change depending on the parameters set for the model.- Specified by:
supportsWeightedDatain interfaceClassifier- Specified by:
supportsWeightedDatain interfaceRegressor- Returns:
- true if the model supports weighted data, false otherwise
-
clone
public ExtraTree clone()
- Specified by:
clonein interfaceClassifier- Specified by:
clonein interfaceRegressor- Overrides:
clonein classjava.lang.Object
-
getTreeNodeVisitor
public TreeNodeVisitor getTreeNodeVisitor()
Description copied from interface:TreeLearnerObtains a node visitor for the tree learner that can be used to traverse and predict from the learned tree- Specified by:
getTreeNodeVisitorin interfaceTreeLearner- Returns:
- the root node visitor for the learned tree
-
train
public void train(RegressionDataSet dataSet, boolean parallel)
-
train
public void train(RegressionDataSet dataSet)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG