public static class RandomForest.Trainer extends ClassifierTrainer<double[]>
Constructor and Description |
---|
Trainer(smile.data.Attribute[] attributes,
int ntrees)
Constructor.
|
Trainer(int mtry,
int ntrees)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
RandomForest.Trainer |
setMaxNodes(int maxNodes)
Sets the maximum number of leaf nodes.
|
RandomForest.Trainer |
setNodeSize(int nodeSize)
Sets the minimum size of leaf nodes.
|
RandomForest.Trainer |
setNumRandomFeatures(int mtry)
Sets the number of random selected features for splitting.
|
RandomForest.Trainer |
setNumTrees(int ntrees)
Sets the number of trees in the random forest.
|
RandomForest.Trainer |
setSamplingRates(double subsample)
Sets the sampling rate.
|
RandomForest.Trainer |
setSplitRule(DecisionTree.SplitRule rule)
Sets the splitting rule.
|
RandomForest |
train(double[][] x,
int[] y)
Learns a classifier with given training data.
|
setAttributes
public Trainer(int mtry, int ntrees)
mtry
- the number of random selected features to be used to determinentrees
- the number of trees.public Trainer(smile.data.Attribute[] attributes, int ntrees)
attributes
- the attributes of independent variable.ntrees
- the number of trees.public RandomForest.Trainer setSplitRule(DecisionTree.SplitRule rule)
rule
- the splitting rule.public RandomForest.Trainer setNumTrees(int ntrees)
ntrees
- the number of trees.public RandomForest.Trainer setNumRandomFeatures(int mtry)
mtry
- the number of random selected features to be used to determine
the decision at a node of the tree. floor(sqrt(p)) seems to give
generally good performance, where p is the number of variables.public RandomForest.Trainer setMaxNodes(int maxNodes)
maxNodes
- the maximum number of leaf nodes.public RandomForest.Trainer setNodeSize(int nodeSize)
nodeSize
- the number of instances in a node below which the tree will not split.public RandomForest.Trainer setSamplingRates(double subsample)
subsample
- the sampling rate.public RandomForest train(double[][] x, int[] y)
ClassifierTrainer
train
in class ClassifierTrainer<double[]>
x
- the training instances.y
- the training labels.