public class RegressionTree extends java.lang.Object implements IRegression, java.io.Serializable
Classification and Regression Tree techniques have a number of advantages over many of those alternative techniques.
Some techniques such as bagging, boosting, and random forest use more than one decision tree for their analysis.
GradientTreeBoost,
RandomForest,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
static interface |
RegressionTree.NodeOutput
An interface to calculate node output.
|
| Constructor and Description |
|---|
RegressionTree()
Initialize a new instance of the RegressionTree class.
|
RegressionTree(DecisionVariable[] attributes)
Initialize a new instance of the RegressionTree class.
|
RegressionTree(DecisionVariable[] attributes,
double[][] x,
double[] y,
int M,
int S,
int[][] order,
int[] samples)
Constructor.
|
RegressionTree(DecisionVariable[] attributes,
int J)
Initialize a new instance of the RegressionTree class.
|
RegressionTree(DecisionVariable[] attributes,
int J,
int[][] order,
int[] samples,
RegressionTree.NodeOutput output)
Constructor.
|
RegressionTree(int J)
Initialize a new instance of the RegressionTree class.
|
RegressionTree(int numFeatures,
int[][] x,
double[] y,
int J)
Constructor.
|
RegressionTree(int numFeatures,
int[][] x,
double[] y,
int J,
int[] samples,
RegressionTree.NodeOutput output)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
IRegression |
clone()
Clone of the object.
|
double[] |
getImportance()
Returns the variable importance.
|
int |
getNumberOfLeafs()
Get number of maximum leafs.
|
void |
Learn(DatasetRegression dataset)
Learn.
|
void |
Learn(double[][] input,
double[] output)
Learn.
|
double |
Predict(double[] feature)
Predict.
|
double |
Predict(int[] feature) |
void |
setNumberOfLeafs(int J)
Set number of maximum leafs.
|
public RegressionTree()
public RegressionTree(DecisionVariable[] attributes)
attributes - Attributes.public RegressionTree(int J)
J - the maximum number of leaf nodes in the tree.public RegressionTree(DecisionVariable[] attributes, int J)
attributes - the attribute properties.J - the maximum number of leaf nodes in the tree.public RegressionTree(DecisionVariable[] attributes, int J, int[][] order, int[] samples, RegressionTree.NodeOutput output)
attributes - the attribute properties.x - the training instances.y - the response variable.order - the index of training values in ascending order. Note
that only numeric attributes need be sorted.J - the maximum number of leaf nodes in the tree.samples - the sample set of instances for stochastic learning.
samples[i] should be 0 or 1 to indicate if the instance is used for training.public RegressionTree(DecisionVariable[] attributes, double[][] x, double[] y, int M, int S, int[][] order, int[] samples)
attributes - the attribute properties.x - the training instances.y - the response variable.order - the index of training values in ascending order. Note
that only numeric attributes need be sorted.M - the number of input variables to pick to split on at each
node. It seems that dim/3 give generally good performance, where dim
is the number of variables.S - number of instances in a node below which the tree will
not split, setting S = 5 generally gives good results.samples - the sample set of instances for stochastic learning.
samples[i] is the number of sampling for instance i.public RegressionTree(int numFeatures,
int[][] x,
double[] y,
int J)
numFeatures - the number of sparse binary features.x - the training instances of sparse binary features.y - the response variable.J - the maximum number of leaf nodes in the tree.public RegressionTree(int numFeatures,
int[][] x,
double[] y,
int J,
int[] samples,
RegressionTree.NodeOutput output)
numFeatures - the number of sparse binary features.x - the training instances.y - the response variable.J - the maximum number of leaf nodes in the tree.samples - the sample set of instances for stochastic learning.
samples[i] should be 0 or 1 to indicate if the instance is used for training.public int getNumberOfLeafs()
public void setNumberOfLeafs(int J)
J - Number of maximum leafs.public double[] getImportance()
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[] feature)
IRegressionPredict in interface IRegressionfeature - Feature.public double Predict(int[] feature)
public IRegression clone()
IRegressionclone in interface IRegressionclone in class java.lang.Object