Class AbstractCARTTrainer<T extends Output<T>>
java.lang.Object
org.tribuo.common.tree.AbstractCARTTrainer<T>
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable,com.oracle.labs.mlrg.olcut.provenance.Provenancable<TrainerProvenance>,DecisionTreeTrainer<T>,SparseTrainer<T>,Trainer<T>,WeightedExamples
public abstract class AbstractCARTTrainer<T extends Output<T>>
extends Object
implements DecisionTreeTrainer<T>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classDeprecated. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected floatNumber of features to sample per split.protected intMaximum tree depth.static final intDefault minimum weight of examples allowed in a leaf node.protected floatMinimum weight of examples allowed in a leaf.protected floatMinimum impurity decrease.protected SplittableRandomprotected longprotected intprotected booleanWhether to choose split points for features at random.Fields inherited from interface org.tribuo.Trainer
DEFAULT_SEED, INCREMENT_INVOCATION_COUNT -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractCARTTrainer(int maxDepth, float minChildWeight, float minImpurityDecrease, float fractionFeaturesInSplit, boolean useRandomSplitPoints, long seed) After calls to this superconstructor subclasses must call postConfig(). -
Method Summary
Modifier and TypeMethodDescriptionfloatReturns the feature subsampling rate.intfloatReturns the minimum decrease in impurity necessary to split a node.booleanReturns whether to choose split points for features at random.protected abstract AbstractTrainingNode<T> mkTrainingNode(Dataset<T> examples, AbstractTrainingNode.LeafDeterminer leafDeterminer) Makes the initial training node.voidUsed by the OLCUT configuration system, and should not be called by external code.voidsetInvocationCount(int invocationCount) train(Dataset<T> examples, Map<String, com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance) train(Dataset<T> examples, Map<String, com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance, int invocationCount) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.oracle.labs.mlrg.olcut.provenance.Provenancable
getProvenance
-
Field Details
-
MIN_EXAMPLES
Default minimum weight of examples allowed in a leaf node.- See Also:
-
minChildWeight
Minimum weight of examples allowed in a leaf. -
maxDepth
Maximum tree depth. Integer.MAX_VALUE indicates the depth is unlimited. -
minImpurityDecrease
@Config(description="The decrease in impurity needed in order to split the node.") protected float minImpurityDecreaseMinimum impurity decrease. The decrease in impurity needed in order to split the node. -
fractionFeaturesInSplit
@Config(description="The fraction of features to consider in each split. 1.0f indicates all features are considered.") protected float fractionFeaturesInSplitNumber of features to sample per split. 1 indicates all features are considered. -
useRandomSplitPoints
@Config(description="Whether to choose split points for features at random.") protected boolean useRandomSplitPointsWhether to choose split points for features at random. -
seed
-
rng
-
trainInvocationCounter
-
-
Constructor Details
-
AbstractCARTTrainer
protected AbstractCARTTrainer(int maxDepth, float minChildWeight, float minImpurityDecrease, float fractionFeaturesInSplit, boolean useRandomSplitPoints, long seed) After calls to this superconstructor subclasses must call postConfig().- Parameters:
maxDepth- The maximum depth of the tree.minChildWeight- The minimum child weight allowed.minImpurityDecrease- The minimum decrease in impurity necessary to split a node.fractionFeaturesInSplit- The fraction of features to consider at each split.useRandomSplitPoints- Whether to choose split points for features at random.seed- The seed for the feature subsampling RNG.
-
-
Method Details
-
postConfig
Used by the OLCUT configuration system, and should not be called by external code.- Specified by:
postConfigin interfacecom.oracle.labs.mlrg.olcut.config.Configurable
-
getInvocationCount
- Specified by:
getInvocationCountin interfaceTrainer<T extends Output<T>>
-
setInvocationCount
- Specified by:
setInvocationCountin interfaceTrainer<T extends Output<T>>
-
getFractionFeaturesInSplit
Description copied from interface:DecisionTreeTrainerReturns the feature subsampling rate.- Specified by:
getFractionFeaturesInSplitin interfaceDecisionTreeTrainer<T extends Output<T>>- Returns:
- The feature subsampling rate.
-
getUseRandomSplitPoints
Description copied from interface:DecisionTreeTrainerReturns whether to choose split points for features at random.- Specified by:
getUseRandomSplitPointsin interfaceDecisionTreeTrainer<T extends Output<T>>- Returns:
- Whether to choose split points for features at random.
-
getMinImpurityDecrease
Description copied from interface:DecisionTreeTrainerReturns the minimum decrease in impurity necessary to split a node.- Specified by:
getMinImpurityDecreasein interfaceDecisionTreeTrainer<T extends Output<T>>- Returns:
- The minimum decrease in impurity necessary to split a node.
-
train
-
train
-
train
-
mkTrainingNode
protected abstract AbstractTrainingNode<T> mkTrainingNode(Dataset<T> examples, AbstractTrainingNode.LeafDeterminer leafDeterminer) Makes the initial training node.- Parameters:
examples- The dataset to use.leafDeterminer- The leaf determination function.- Returns:
- The initial training node.
-