public class RandomForest extends java.lang.Object implements IRegression, java.io.Serializable
Each tree is constructed using the following algorithm:
| Constructor and Description |
|---|
RandomForest()
Initialize a new instance of the RandomForest class.
|
RandomForest(DecisionVariable[] attributes)
Initialize a new instance of the RandomForest class.
|
RandomForest(DecisionVariable[] attributes,
int T)
Initialize a new instance of the RandomForest class.
|
RandomForest(DecisionVariable[] attributes,
int T,
int M)
Initialize a new instance of the RandomForest class.
|
RandomForest(DecisionVariable[] attributes,
int T,
int M,
int S)
Constructor.
|
RandomForest(int T)
Initialize a new instance of the RandomForest class.
|
RandomForest(int T,
int M)
Initialize a new instance of the RandomForest class.
|
RandomForest(int T,
int M,
int S)
Initialize a new instance of the RandomForest class.
|
| Modifier and Type | Method and Description |
|---|---|
IRegression |
clone()
Clone of the object.
|
double |
error()
Returns the out-of-bag estimation of RMSE.
|
double[] |
getImportance()
Returns the variable importance.
|
void |
Learn(DatasetRegression dataset)
Learn.
|
void |
Learn(double[][] input,
double[] output)
Learn.
|
double |
Predict(double[] x)
Predict.
|
int |
size()
Returns the number of trees in the model.
|
void |
trim(int T)
Trims the tree model set to a smaller size in case of over-fitting.
|
public RandomForest()
public RandomForest(int T)
T - Number of the trees.public RandomForest(int T,
int M)
T - the number of trees.M - the number of input variables to be used to determine the decision
at a node of the tree. dim/3 seems to give generally good performance,
where dim is the number of variables.public RandomForest(int T,
int M,
int S)
T - the number of trees.M - the number of input variables to be used to determine the decision
at a node of the tree. dim/3 seems to give generally good performance,
where dim is the number of variables.S - the number of instances in a node below which the tree will
not split, setting S = 5 generally gives good results.public RandomForest(DecisionVariable[] attributes)
attributes - Attributes.public RandomForest(DecisionVariable[] attributes, int T)
attributes - the attribute properties.T - Number of trees.public RandomForest(DecisionVariable[] attributes, int T, int M)
attributes - the attribute properties.T - Number of trees.M - the number of input variables to be used to determine the decision
at a node of the tree. dim/3 seems to give generally good performance,
where dim is the number of variables.public RandomForest(DecisionVariable[] attributes, int T, int M, int S)
attributes - the attribute properties.T - the Number of trees.M - the number of input variables to be used to determine the decision
at a node of the tree. dim/3 seems to give generally good performance,
where dim is the number of variables.S - the number of instances in a node below which the tree will
not split, setting S = 5 generally gives good results.public double error()
public double[] getImportance()
public int size()
public void trim(int T)
T - the new (smaller) size of tree model set.public void Learn(DatasetRegression dataset)
IRegressionLearn in interface IRegressiondataset - Dataset regression.public void Learn(double[][] input,
double[] output)
IRegressionLearn in interface IRegressioninput - Input.output - Output.public double Predict(double[] x)
IRegressionPredict in interface IRegressionx - Feature.public IRegression clone()
IRegressionclone in interface IRegressionclone in class java.lang.Object