public static class DecisionTree.Trainer extends ClassifierTrainer<double[]>
Constructor and Description |
---|
Trainer()
Default constructor of maximal 100 leaf nodes in the tree.
|
Trainer(smile.data.Attribute[] attributes,
int maxNodes)
Constructor.
|
Trainer(int maxNodes)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
DecisionTree.Trainer |
setMaxNodes(int maxNodes)
Sets the maximum number of leaf nodes in the tree.
|
DecisionTree.Trainer |
setNodeSize(int nodeSize)
Sets the minimum size of leaf nodes.
|
DecisionTree.Trainer |
setSplitRule(DecisionTree.SplitRule rule)
Sets the splitting rule.
|
DecisionTree |
train(double[][] x,
int[] y)
Learns a classifier with given training data.
|
setAttributes
public Trainer()
public Trainer(int maxNodes)
maxNodes
- the maximum number of leaf nodes in the tree.public Trainer(smile.data.Attribute[] attributes, int maxNodes)
attributes
- the attributes of independent variable.maxNodes
- the maximum number of leaf nodes in the tree.public DecisionTree.Trainer setSplitRule(DecisionTree.SplitRule rule)
rule
- the splitting rule.public DecisionTree.Trainer setMaxNodes(int maxNodes)
maxNodes
- the maximum number of leaf nodes in the tree.public DecisionTree.Trainer setNodeSize(int nodeSize)
nodeSize
- the minimum size of leaf nodes..public DecisionTree train(double[][] x, int[] y)
ClassifierTrainer
train
in class ClassifierTrainer<double[]>
x
- the training instances.y
- the training labels.