public static class RandomForest.Trainer extends RegressionTrainer<double[]>
| Constructor and Description |
|---|
Trainer(smile.data.Attribute[] attributes,
int ntrees)
Constructor.
|
Trainer(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 |
train(double[][] x,
double[] y)
Learns a regression model with given training data.
|
setAttributespublic Trainer(int ntrees)
ntrees - 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 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. p/3 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, double[] y)
RegressionTrainertrain in class RegressionTrainer<double[]>x - the training instances.y - the training response values.