InputType
- The input type for supervised learning. Passed on to the internal
learning algorithm. Also the input type for the learned ensemble.CategoryType
- The output type for supervised learning. Passed on to the internal
learning algorithm. Also the output type of the learned ensemble.@PublicationReference(title="Bagging Predictors", author="Leo Breiman", year=1996, type=Journal, publication="Machine Learning", pages={123,140}, url="http://www.springerlink.com/index/L4780124W2874025.pdf") public class BaggingCategorizerLearner<InputType,CategoryType> extends AbstractBaggingLearner<InputType,CategoryType,Evaluator<? super InputType,? extends CategoryType>,WeightedVotingCategorizerEnsemble<InputType,CategoryType,Evaluator<? super InputType,? extends CategoryType>>> implements BagBasedCategorizerEnsembleLearner<InputType,CategoryType>
Modifier and Type | Class and Description |
---|---|
static class |
BaggingCategorizerLearner.OutOfBagErrorStoppingCriteria<InputType,CategoryType>
Implements a stopping criteria for bagging that uses the out-of-bag
error to determine when to stop learning the ensemble.
|
bag, dataInBag, dataList, DEFAULT_MAX_ITERATIONS, DEFAULT_PERCENT_TO_SAMPLE, ensemble, learner, percentToSample, random
data, keepGoing
maxIterations
DEFAULT_ITERATION, iteration
Constructor and Description |
---|
BaggingCategorizerLearner()
Creates a new instance of BaggingCategorizerLearner.
|
BaggingCategorizerLearner(BatchLearner<? super java.util.Collection<? extends InputOutputPair<? extends InputType,CategoryType>>,? extends Evaluator<? super InputType,? extends CategoryType>> learner)
Creates a new instance of BaggingCategorizerLearner.
|
BaggingCategorizerLearner(BatchLearner<? super java.util.Collection<? extends InputOutputPair<? extends InputType,CategoryType>>,? extends Evaluator<? super InputType,? extends CategoryType>> learner,
int maxIterations,
double percentToSample,
java.util.Random random)
Creates a new instance of BaggingCategorizerLearner.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addEnsembleMember(Evaluator<? super InputType,? extends CategoryType> member)
Adds a new member to the ensemble.
|
protected WeightedVotingCategorizerEnsemble<InputType,CategoryType,Evaluator<? super InputType,? extends CategoryType>> |
createInitialEnsemble()
Create the initial, empty ensemble for the algorithm to use.
|
int[] |
getDataInBag()
Gets the array of counts of the number of samples of each example in
the current bag.
|
InputOutputPair<? extends InputType,CategoryType> |
getExample(int index)
Gets the training example at the given index.
|
cleanupAlgorithm, fillBag, getBag, getDataList, getEnsemble, getLearner, getPercentToSample, getRandom, getResult, initializeAlgorithm, setBag, setDataInBag, setDataList, setEnsemble, setLearner, setPercentToSample, setRandom, step
clone, getData, getKeepGoing, learn, setData, setKeepGoing, stop
getMaxIterations, isResultValid, setMaxIterations
addIterativeAlgorithmListener, fireAlgorithmEnded, fireAlgorithmStarted, fireStepEnded, fireStepStarted, getIteration, getListeners, removeIterativeAlgorithmListener, setIteration, setListeners
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getData, getKeepGoing
getMaxIterations, getResult, setMaxIterations
addIterativeAlgorithmListener, getIteration, removeIterativeAlgorithmListener
isResultValid, stop
learn
clone
public BaggingCategorizerLearner()
public BaggingCategorizerLearner(BatchLearner<? super java.util.Collection<? extends InputOutputPair<? extends InputType,CategoryType>>,? extends Evaluator<? super InputType,? extends CategoryType>> learner)
learner
- The learner to use to create the categorizer on each iteration.public BaggingCategorizerLearner(BatchLearner<? super java.util.Collection<? extends InputOutputPair<? extends InputType,CategoryType>>,? extends Evaluator<? super InputType,? extends CategoryType>> learner, int maxIterations, double percentToSample, java.util.Random random)
learner
- The learner to use to create the categorizer on each iteration.maxIterations
- The maximum number of iterations to run for, which is also the
number of learners to create.percentToSample
- The percentage of the total size of the data to sample on each
iteration. Must be positive.random
- The random number generator to use.protected WeightedVotingCategorizerEnsemble<InputType,CategoryType,Evaluator<? super InputType,? extends CategoryType>> createInitialEnsemble()
AbstractBaggingLearner
createInitialEnsemble
in class AbstractBaggingLearner<InputType,CategoryType,Evaluator<? super InputType,? extends CategoryType>,WeightedVotingCategorizerEnsemble<InputType,CategoryType,Evaluator<? super InputType,? extends CategoryType>>>
protected void addEnsembleMember(Evaluator<? super InputType,? extends CategoryType> member)
AbstractBaggingLearner
addEnsembleMember
in class AbstractBaggingLearner<InputType,CategoryType,Evaluator<? super InputType,? extends CategoryType>,WeightedVotingCategorizerEnsemble<InputType,CategoryType,Evaluator<? super InputType,? extends CategoryType>>>
member
- The new member to add to the ensemble.public int[] getDataInBag()
AbstractBaggingLearner
getDataInBag
in interface BagBasedCategorizerEnsembleLearner<InputType,CategoryType>
getDataInBag
in class AbstractBaggingLearner<InputType,CategoryType,Evaluator<? super InputType,? extends CategoryType>,WeightedVotingCategorizerEnsemble<InputType,CategoryType,Evaluator<? super InputType,? extends CategoryType>>>
public InputOutputPair<? extends InputType,CategoryType> getExample(int index)
BagBasedCategorizerEnsembleLearner
getExample
in interface BagBasedCategorizerEnsembleLearner<InputType,CategoryType>
index
- The 0-based index to lookup.