Package org.tribuo.common.tree
Class RandomForestTrainer<T extends Output<T>>
java.lang.Object
org.tribuo.ensemble.BaggingTrainer<T>
org.tribuo.common.tree.RandomForestTrainer<T>
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable
,com.oracle.labs.mlrg.olcut.provenance.Provenancable<TrainerProvenance>
,Trainer<T>
A trainer which produces a random forest.
Random Forests are basically bagged trees, with feature subsampling at each of the nodes. An exception will be thrown if the user does not supply a decision tree trainer with feature subsampling turned on and random splitting turned off.
See:
J. Friedman, T. Hastie, & R. Tibshirani. "The Elements of Statistical Learning" Springer 2001. PDF
-
Field Summary
Fields inherited from class org.tribuo.ensemble.BaggingTrainer
combiner, innerTrainer, numMembers, rng, seed, trainInvocationCounter
Fields inherited from interface org.tribuo.Trainer
DEFAULT_SEED, INCREMENT_INVOCATION_COUNT
-
Constructor Summary
ConstructorDescriptionRandomForestTrainer
(DecisionTreeTrainer<T> trainer, EnsembleCombiner<T> combiner, int numMembers) Constructs a RandomForestTrainer with the default seedTrainer.DEFAULT_SEED
.RandomForestTrainer
(DecisionTreeTrainer<T> trainer, EnsembleCombiner<T> combiner, int numMembers, long seed) Constructs a RandomForestTrainer with the supplied seed, trainer, combining function and number of members. -
Method Summary
Methods inherited from class org.tribuo.ensemble.BaggingTrainer
getInvocationCount, getProvenance, setInvocationCount, train, train, train, trainSingleModel
-
Constructor Details
-
RandomForestTrainer
public RandomForestTrainer(DecisionTreeTrainer<T> trainer, EnsembleCombiner<T> combiner, int numMembers) Constructs a RandomForestTrainer with the default seedTrainer.DEFAULT_SEED
.Throws
PropertyException
if the trainer is not set to subsample the features.- Parameters:
trainer
- The tree trainer.combiner
- The combining function for the ensemble.numMembers
- The number of ensemble members to train.
-
RandomForestTrainer
public RandomForestTrainer(DecisionTreeTrainer<T> trainer, EnsembleCombiner<T> combiner, int numMembers, long seed) Constructs a RandomForestTrainer with the supplied seed, trainer, combining function and number of members.Throws
PropertyException
if the trainer is not set to subsample the features.- Parameters:
trainer
- The tree trainer.combiner
- The combining function for the ensemble.numMembers
- The number of ensemble members to train.seed
- The RNG seed.
-
-
Method Details
-
postConfig
public void postConfig()Used by the OLCUT configuration system, and should not be called by external code.- Specified by:
postConfig
in interfacecom.oracle.labs.mlrg.olcut.config.Configurable
- Overrides:
postConfig
in classBaggingTrainer<T extends Output<T>>
-
ensembleName
Description copied from class:BaggingTrainer
Default name of the generated ensemble.- Overrides:
ensembleName
in classBaggingTrainer<T extends Output<T>>
- Returns:
- The default ensemble name.
-
toString
- Overrides:
toString
in classBaggingTrainer<T extends Output<T>>
-