Package org.tribuo.regression.rtree
Class CARTRegressionTrainer
java.lang.Object
org.tribuo.common.tree.AbstractCARTTrainer<Regressor>
org.tribuo.regression.rtree.CARTRegressionTrainer
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable
,com.oracle.labs.mlrg.olcut.provenance.Provenancable<TrainerProvenance>
,DecisionTreeTrainer<Regressor>
,SparseTrainer<Regressor>
,Trainer<Regressor>
,WeightedExamples
-
Nested Class Summary
Nested classes/interfaces inherited from class org.tribuo.common.tree.AbstractCARTTrainer
AbstractCARTTrainer.AbstractCARTTrainerProvenance
-
Field Summary
Fields inherited from class org.tribuo.common.tree.AbstractCARTTrainer
fractionFeaturesInSplit, maxDepth, MIN_EXAMPLES, minChildWeight, minImpurityDecrease, rng, seed, trainInvocationCounter, useRandomSplitPoints
Fields inherited from interface org.tribuo.Trainer
DEFAULT_SEED, INCREMENT_INVOCATION_COUNT
-
Constructor Summary
ConstructorDescriptionCreates a CART trainer.CARTRegressionTrainer
(int maxDepth) Creates a CART trainer.CARTRegressionTrainer
(int maxDepth, float minChildWeight, float minImpurityDecrease, float fractionFeaturesInSplit, boolean useRandomSplitPoints, RegressorImpurity impurity, long seed) Creates a CART Trainer.CARTRegressionTrainer
(int maxDepth, float minChildWeight, float minImpurityDecrease, float fractionFeaturesInSplit, RegressorImpurity impurity, long seed) Creates a CART Trainer. -
Method Summary
Modifier and TypeMethodDescriptionprotected AbstractTrainingNode<Regressor>
mkTrainingNode
(Dataset<Regressor> examples, AbstractTrainingNode.LeafDeterminer leafDeterminer) Makes the initial training node.toString()
train
(Dataset<Regressor> examples, Map<String, com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance) Trains a sparse predictive model using the examples in the given data set.train
(Dataset<Regressor> examples, Map<String, com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance, int invocationCount) Trains a predictive model using the examples in the given data set.Methods inherited from class org.tribuo.common.tree.AbstractCARTTrainer
getFractionFeaturesInSplit, getInvocationCount, getMinImpurityDecrease, getUseRandomSplitPoints, postConfig, setInvocationCount, train
-
Constructor Details
-
CARTRegressionTrainer
public CARTRegressionTrainer(int maxDepth, float minChildWeight, float minImpurityDecrease, float fractionFeaturesInSplit, boolean useRandomSplitPoints, RegressorImpurity impurity, long seed) Creates a CART Trainer.- Parameters:
maxDepth
- maxDepth The maximum depth of the tree.minChildWeight
- minChildWeight The minimum node weight to consider it for a split.minImpurityDecrease
- The minimum decrease in impurity necessary to split a node.fractionFeaturesInSplit
- fractionFeaturesInSplit The fraction of features available in each split.useRandomSplitPoints
- Whether to choose split points for features at random.impurity
- impurity The impurity function to use to determine split quality.seed
- The RNG seed.
-
CARTRegressionTrainer
public CARTRegressionTrainer(int maxDepth, float minChildWeight, float minImpurityDecrease, float fractionFeaturesInSplit, RegressorImpurity impurity, long seed) Creates a CART Trainer.Computes the exact split point.
- Parameters:
maxDepth
- maxDepth The maximum depth of the tree.minChildWeight
- minChildWeight The minimum node weight to consider it for a split.minImpurityDecrease
- The minimum decrease in impurity necessary to split a node.fractionFeaturesInSplit
- fractionFeaturesInSplit The fraction of features available in each split.impurity
- impurity The impurity function to use to determine split quality.seed
- The RNG seed.
-
CARTRegressionTrainer
public CARTRegressionTrainer()Creates a CART trainer.Sets the impurity to the
MeanSquaredError
, uses all the features, computes the exact split point, and sets the minimum number of examples in a leaf toAbstractCARTTrainer.MIN_EXAMPLES
. -
CARTRegressionTrainer
public CARTRegressionTrainer(int maxDepth) Creates a CART trainer.Sets the impurity to the
MeanSquaredError
, uses all the features, computes the exact split point and sets the minimum number of examples in a leaf toAbstractCARTTrainer.MIN_EXAMPLES
.- Parameters:
maxDepth
- The maximum depth of the tree.
-
-
Method Details
-
mkTrainingNode
protected AbstractTrainingNode<Regressor> mkTrainingNode(Dataset<Regressor> examples, AbstractTrainingNode.LeafDeterminer leafDeterminer) Description copied from class:AbstractCARTTrainer
Makes the initial training node.- Specified by:
mkTrainingNode
in classAbstractCARTTrainer<Regressor>
- Parameters:
examples
- The dataset to use.leafDeterminer
- The leaf determination function.- Returns:
- The initial training node.
-
train
public TreeModel<Regressor> train(Dataset<Regressor> examples, Map<String, com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance) Description copied from interface:SparseTrainer
Trains a sparse predictive model using the examples in the given data set.- Specified by:
train
in interfaceSparseTrainer<Regressor>
- Specified by:
train
in interfaceTrainer<Regressor>
- Overrides:
train
in classAbstractCARTTrainer<Regressor>
- Parameters:
examples
- the data set containing the examples.runProvenance
- Training run specific provenance (e.g., fold number).- Returns:
- a predictive model that can be used to generate predictions for new examples.
-
train
public TreeModel<Regressor> train(Dataset<Regressor> examples, Map<String, com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance, int invocationCount) Description copied from interface:SparseTrainer
Trains a predictive model using the examples in the given data set.- Specified by:
train
in interfaceSparseTrainer<Regressor>
- Specified by:
train
in interfaceTrainer<Regressor>
- Overrides:
train
in classAbstractCARTTrainer<Regressor>
- Parameters:
examples
- the data set containing the examples.runProvenance
- Training run specific provenance (e.g., fold number).invocationCount
- The state of the RNG the trainer should be set to before training- Returns:
- a predictive model that can be used to generate predictions for new examples.
-
toString
-
getProvenance
-