public class AdaBoostTrainer extends Object implements Trainer<Label>
If the trainer implements WeightedExamples
then it performs boosting by weighting,
otherwise it uses a weighted bootstrap sample.
See:
J. Zhu, S. Rosset, H. Zou, T. Hastie. "Multi-class Adaboost" 2006.
Modifier and Type | Field and Description |
---|---|
protected Trainer<Label> |
innerTrainer |
protected int |
numMembers |
protected SplittableRandom |
rng |
protected long |
seed |
protected int |
trainInvocationCounter |
DEFAULT_SEED
Constructor and Description |
---|
AdaBoostTrainer(Trainer<Label> trainer,
int numMembers)
Constructs an adaboost trainer using the supplied weak learner trainer and the specified number of
boosting rounds.
|
AdaBoostTrainer(Trainer<Label> trainer,
int numMembers,
long seed)
Constructs an adaboost trainer using the supplied weak learner trainer, the specified number of
boosting rounds and the supplied seed.
|
Modifier and Type | Method and Description |
---|---|
int |
getInvocationCount()
The number of times this trainer instance has had it's train method invoked.
|
TrainerProvenance |
getProvenance() |
void |
postConfig() |
String |
toString() |
Model<Label> |
train(Dataset<Label> examples,
Map<String,com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance)
If the trainer implements
WeightedExamples then do boosting by weighting,
otherwise do boosting by sampling. |
@Config(mandatory=true, description="The trainer to use to build each weak learner.") protected Trainer<Label> innerTrainer
@Config(mandatory=true, description="The number of ensemble members to train.") protected int numMembers
@Config(mandatory=true, description="The seed for the RNG.") protected long seed
protected SplittableRandom rng
protected int trainInvocationCounter
public AdaBoostTrainer(Trainer<Label> trainer, int numMembers)
trainer
- The weak learner trainer.numMembers
- The maximum number of boosting rounds.public AdaBoostTrainer(Trainer<Label> trainer, int numMembers, long seed)
trainer
- The weak learner trainer.numMembers
- The maximum number of boosting rounds.seed
- The RNG seed.public void postConfig()
postConfig
in interface com.oracle.labs.mlrg.olcut.config.Configurable
public Model<Label> train(Dataset<Label> examples, Map<String,com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance)
WeightedExamples
then do boosting by weighting,
otherwise do boosting by sampling.train
in interface Trainer<Label>
examples
- the data set containing the examples.runProvenance
- Training run specific provenance (e.g., fold number).WeightedEnsembleModel
.public int getInvocationCount()
Trainer
This is used to determine how many times the trainer's RNG has been accessed to ensure replicability in the random number stream.
getInvocationCount
in interface Trainer<Label>
public TrainerProvenance getProvenance()
getProvenance
in interface com.oracle.labs.mlrg.olcut.provenance.Provenancable<TrainerProvenance>
Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.