Package org.tribuo.classification.dtree
Class CARTClassificationTrainer
java.lang.Object
org.tribuo.common.tree.AbstractCARTTrainer<Label>
org.tribuo.classification.dtree.CARTClassificationTrainer
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable
,com.oracle.labs.mlrg.olcut.provenance.Provenancable<TrainerProvenance>
,DecisionTreeTrainer<Label>
,SparseTrainer<Label>
,Trainer<Label>
,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.CARTClassificationTrainer
(int maxDepth) Creates a CART trainer.CARTClassificationTrainer
(int maxDepth, float fractionFeaturesInSplit, boolean useRandomSplitPoints, long seed) Creates a CART Trainer.CARTClassificationTrainer
(int maxDepth, float minChildWeight, float minImpurityDecrease, float fractionFeaturesInSplit, boolean useRandomSplitPoints, LabelImpurity impurity, long seed) Creates a CART Trainer.CARTClassificationTrainer
(int maxDepth, float minChildWeight, float minImpurityDecrease, float fractionFeaturesInSplit, LabelImpurity impurity, long seed) Creates a CART Trainer.CARTClassificationTrainer
(int maxDepth, float fractionFeaturesInSplit, long seed) Creates a CART Trainer. -
Method Summary
Modifier and TypeMethodDescriptionprotected AbstractTrainingNode<Label>
mkTrainingNode
(Dataset<Label> examples, AbstractTrainingNode.LeafDeterminer leafDeterminer) Makes the initial training node.toString()
Methods inherited from class org.tribuo.common.tree.AbstractCARTTrainer
getFractionFeaturesInSplit, getInvocationCount, getMinImpurityDecrease, getUseRandomSplitPoints, postConfig, setInvocationCount, train, train, train
-
Constructor Details
-
CARTClassificationTrainer
public CARTClassificationTrainer(int maxDepth, float minChildWeight, float minImpurityDecrease, float fractionFeaturesInSplit, boolean useRandomSplitPoints, LabelImpurity impurity, long seed) Creates a CART Trainer.- Parameters:
maxDepth
- The maximum depth of the tree.minChildWeight
- The minimum node weight to consider it for a split.minImpurityDecrease
- The minimum decrease in impurity necessary to split a node.fractionFeaturesInSplit
- The fraction of features available in each split.useRandomSplitPoints
- Whether to choose split points for features at random.impurity
- Impurity measure to determine split quality. SeeLabelImpurity
.seed
- The RNG seed.
-
CARTClassificationTrainer
public CARTClassificationTrainer()Creates a CART Trainer.Sets the impurity to the
GiniIndex
, uses all the features, builds an arbitrary depth tree, computes the exact split point and sets the minimum number of examples in a leaf toAbstractCARTTrainer.MIN_EXAMPLES
. -
CARTClassificationTrainer
public CARTClassificationTrainer(int maxDepth) Creates a CART trainer.Sets the impurity to the
GiniIndex
, 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.
-
CARTClassificationTrainer
public CARTClassificationTrainer(int maxDepth, float fractionFeaturesInSplit, long seed) Creates a CART Trainer.Sets the impurity to the
GiniIndex
.- Parameters:
maxDepth
- The maximum depth of the tree.fractionFeaturesInSplit
- The fraction of features available in each split.seed
- The seed for the RNG.
-
CARTClassificationTrainer
public CARTClassificationTrainer(int maxDepth, float fractionFeaturesInSplit, boolean useRandomSplitPoints, long seed) Creates a CART Trainer.Sets the impurity to the
GiniIndex
. Computes the exact split point.- Parameters:
maxDepth
- The maximum depth of the tree.fractionFeaturesInSplit
- The fraction of features available in each split.useRandomSplitPoints
- Whether to choose split points for features at random.seed
- The seed for the RNG.
-
CARTClassificationTrainer
public CARTClassificationTrainer(int maxDepth, float minChildWeight, float minImpurityDecrease, float fractionFeaturesInSplit, LabelImpurity impurity, long seed) Creates a CART Trainer.Computes the exact split point.
- Parameters:
maxDepth
- The maximum depth of the tree.minChildWeight
- The minimum node weight to consider it for a split.minImpurityDecrease
- The minimum decrease in impurity necessary to split a node.fractionFeaturesInSplit
- The fraction of features available in each split.impurity
- Impurity measure to determine split quality. SeeLabelImpurity
.seed
- The RNG seed.
-
-
Method Details
-
mkTrainingNode
protected AbstractTrainingNode<Label> mkTrainingNode(Dataset<Label> examples, AbstractTrainingNode.LeafDeterminer leafDeterminer) Description copied from class:AbstractCARTTrainer
Makes the initial training node.- Specified by:
mkTrainingNode
in classAbstractCARTTrainer<Label>
- Parameters:
examples
- The dataset to use.leafDeterminer
- The leaf determination function.- Returns:
- The initial training node.
-
toString
-
getProvenance
-