jsat.classifiers.trees
Class ERTrees
- java.lang.Object
-
- jsat.classifiers.trees.ExtraTree
-
- jsat.classifiers.trees.ERTrees
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Classifier, TreeLearner, Parameterized, Regressor
public class ERTrees extends ExtraTree
Extra Randomized Trees (ERTrees) is an ensemble method built on top ofExtraTree. The randomness of the trees provides incredibly high variance, yet a low bias. The sum of many randomized trees proves to be a powerful and fast learner.
The default settings are those suggested in the paper. However, the default stop size suggested (especially for classification) is often too small. You may want to consider increasing it if the accuracy is too low.
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 ERTrees()Creates a new Extremely Randomized Trees learnerERTrees(ERTrees toCopy)Copy constructorERTrees(int forrestSize)Creates a new Extremely Randomized Trees learner
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description CategoricalResultsclassify(DataPoint data)Performs classification on the given data point.ERTreesclone()<Type extends DataSet>
OnLineStatistics[]evaluateFeatureImportance(DataSet<Type> data)Measures the statistics of feature importance from the trees in this forest.<Type extends DataSet>
OnLineStatistics[]evaluateFeatureImportance(DataSet<Type> data, TreeFeatureImportanceInference imp)Measures the statistics of feature importance from the trees in this forest.intgetForrestSize()TreeNodeVisitorgetTreeNodeVisitor()Obtains a node visitor for the tree learner that can be used to traverse and predict from the learned treebooleangetUseDefaultSelectionCount()Returns if the default heuristic for the selection count is usedbooleangetUseDefaultStopSize()Returns if the default heuristic for the stop size is useddoubleregress(DataPoint data)voidsetForrestSize(int forrestSize)voidsetUseDefaultSelectionCount(boolean useDefaultSelectionCount)Sets whether or not to use the default heuristic for the number of random features to select as candidates for each node.voidsetUseDefaultStopSize(boolean useDefaultStopSize)Sets whether or not to us the default heuristic for the number of points to force a new node to be a leaf.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, boolean parallel)-
Methods inherited from class jsat.classifiers.trees.ExtraTree
getImpurityMeasure, getSelectionCount, getStopSize, isBinaryCategoricalSplitting, setBinaryCategoricalSplitting, setImpurityMeasure, setSelectionCount, setStopSize, train
-
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
-
ERTrees
public ERTrees()
Creates a new Extremely Randomized Trees learner
-
ERTrees
public ERTrees(int forrestSize)
Creates a new Extremely Randomized Trees learner- Parameters:
forrestSize- the number of trees to construct
-
ERTrees
public ERTrees(ERTrees toCopy)
Copy constructor- Parameters:
toCopy- the object to copy
-
-
Method Detail
-
evaluateFeatureImportance
public <Type extends DataSet> OnLineStatistics[] evaluateFeatureImportance(DataSet<Type> data)
Measures the statistics of feature importance from the trees in this forest. For classification datasets, theMDImethod with Gini impurity will be used. For others, theImportanceByUsesmethod will be used. This may change in the future.- Type Parameters:
Type-- Parameters:
data- the dataset to infer the feature importance from with respect to the current model.- Returns:
- an array of statistics, which each index corresponds to a specific feature. Numeric features start from the zero index, categorical features start from the index equal to the number of numeric features.
-
evaluateFeatureImportance
public <Type extends DataSet> OnLineStatistics[] evaluateFeatureImportance(DataSet<Type> data, TreeFeatureImportanceInference imp)
Measures the statistics of feature importance from the trees in this forest.- Type Parameters:
Type-- Parameters:
data- the dataset to infer the feature importance from with respect to the current model.imp- the method of determing the feature importance that will be applied to each tree in this model- Returns:
- an array of statistics, which each index corresponds to a specific feature. Numeric features start from the zero index, categorical features start from the index equal to the number of numeric features.
-
setUseDefaultSelectionCount
public void setUseDefaultSelectionCount(boolean useDefaultSelectionCount)
Sets whether or not to use the default heuristic for the number of random features to select as candidates for each node. If true the value of selectionCount will be modified during training, using sqrt(n) features for classification and all features for regression. Otherwise, whatever value set before hand will be used.- Parameters:
useDefaultSelectionCount- whether or not to use the heuristic version
-
getUseDefaultSelectionCount
public boolean getUseDefaultSelectionCount()
Returns if the default heuristic for the selection count is used- Returns:
- if the default heuristic for the selection count is used
-
setUseDefaultStopSize
public void setUseDefaultStopSize(boolean useDefaultStopSize)
Sets whether or not to us the default heuristic for the number of points to force a new node to be a leaf. If true the value for stopSize will be altered during training, set to 2 for classification and 5 for regression. Otherwise, whatever value set beforehand will be used.- Parameters:
useDefaultStopSize- whether or not to use the heuristic version
-
getUseDefaultStopSize
public boolean getUseDefaultStopSize()
Returns if the default heuristic for the stop size is used- Returns:
- if the default heuristic for the stop size is used
-
setForrestSize
public void setForrestSize(int forrestSize)
-
getForrestSize
public int getForrestSize()
-
classify
public CategoricalResults classify(DataPoint data)
Description copied from interface:ClassifierPerforms classification on the given data point.- Specified by:
classifyin interfaceClassifier- Overrides:
classifyin classExtraTree- 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- Overrides:
trainin classExtraTree- 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- Overrides:
supportsWeightedDatain classExtraTree- Returns:
- true if the model supports weighted data, false otherwise
-
regress
public double regress(DataPoint data)
-
train
public void train(RegressionDataSet dataSet, boolean parallel)
-
clone
public ERTrees clone()
-
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- Overrides:
getTreeNodeVisitorin classExtraTree- Returns:
- the root node visitor for the learned tree
-
-
DataMelt 3.0 © DataMelt by jWork.ORG