InputType
- Input class of the Collection<InputOutputPairs>
for the dataset, for example, something like Vector or String@CodeReview(reviewer="Kevin R. Dixon", date="2008-07-23", changesNeeded=false, comments={"Cleaned up javadoc a little bit with code annotations.","Otherwise, looks fine."}) public class BinaryBaggingLearner<InputType> extends AbstractBaggingLearner<InputType,java.lang.Boolean,Evaluator<? super InputType,? extends java.lang.Boolean>,WeightedBinaryEnsemble<InputType,Evaluator<? super InputType,? extends java.lang.Boolean>>>
BinaryBaggingLearner
implements the Bagging learning algorithm.
At each step, the algorithm creates a "bag" of data by sampling from the
given data with replacement. It then passes the bag of data to the given
learner to learn a new binary categorizer, which it then adds to the
ensemble. All learners are given an equal weight of 1.0.bag, dataInBag, dataList, DEFAULT_MAX_ITERATIONS, DEFAULT_PERCENT_TO_SAMPLE, ensemble, learner, percentToSample, random
data, keepGoing
maxIterations
DEFAULT_ITERATION, iteration
Constructor and Description |
---|
BinaryBaggingLearner()
Creates a new instance of BinaryBaggingLearner.
|
BinaryBaggingLearner(BatchLearner<? super java.util.Collection<? extends InputOutputPair<? extends InputType,java.lang.Boolean>>,? extends Evaluator<? super InputType,? extends java.lang.Boolean>> learner)
Creates a new instance of BinaryBaggingLearner.
|
BinaryBaggingLearner(BatchLearner<? super java.util.Collection<? extends InputOutputPair<? extends InputType,java.lang.Boolean>>,? extends Evaluator<? super InputType,? extends java.lang.Boolean>> learner,
int maxIterations)
Creates a new instance of BinaryBaggingLearner.
|
BinaryBaggingLearner(BatchLearner<? super java.util.Collection<? extends InputOutputPair<? extends InputType,java.lang.Boolean>>,? extends Evaluator<? super InputType,? extends java.lang.Boolean>> learner,
int maxIterations,
double percentToSample,
java.util.Random random)
Creates a new instance of BinaryBaggingLearner.
|
BinaryBaggingLearner(BatchLearner<? super java.util.Collection<? extends InputOutputPair<? extends InputType,java.lang.Boolean>>,? extends Evaluator<? super InputType,? extends java.lang.Boolean>> learner,
int maxIterations,
java.util.Random random)
Creates a new instance of BinaryBaggingLearner.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addEnsembleMember(Evaluator<? super InputType,? extends java.lang.Boolean> member)
Adds a new member to the ensemble.
|
protected WeightedBinaryEnsemble<InputType,Evaluator<? super InputType,? extends java.lang.Boolean>> |
createInitialEnsemble()
Create the initial, empty ensemble for the algorithm to use.
|
cleanupAlgorithm, fillBag, getBag, getDataInBag, 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
learn
clone
getMaxIterations, setMaxIterations
addIterativeAlgorithmListener, getIteration, removeIterativeAlgorithmListener
isResultValid
public BinaryBaggingLearner()
public BinaryBaggingLearner(BatchLearner<? super java.util.Collection<? extends InputOutputPair<? extends InputType,java.lang.Boolean>>,? extends Evaluator<? super InputType,? extends java.lang.Boolean>> learner)
learner
- The learner to use to create the categorizer on each iteration.public BinaryBaggingLearner(BatchLearner<? super java.util.Collection<? extends InputOutputPair<? extends InputType,java.lang.Boolean>>,? extends Evaluator<? super InputType,? extends java.lang.Boolean>> learner, int maxIterations)
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.public BinaryBaggingLearner(BatchLearner<? super java.util.Collection<? extends InputOutputPair<? extends InputType,java.lang.Boolean>>,? extends Evaluator<? super InputType,? extends java.lang.Boolean>> learner, int maxIterations, 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.random
- The random number generator to use.public BinaryBaggingLearner(BatchLearner<? super java.util.Collection<? extends InputOutputPair<? extends InputType,java.lang.Boolean>>,? extends Evaluator<? super InputType,? extends java.lang.Boolean>> learner, int maxIterations, double percentToSample, java.util.Random random)
learner
- The learner to use to create the ensemble member 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 WeightedBinaryEnsemble<InputType,Evaluator<? super InputType,? extends java.lang.Boolean>> createInitialEnsemble()
AbstractBaggingLearner
createInitialEnsemble
in class AbstractBaggingLearner<InputType,java.lang.Boolean,Evaluator<? super InputType,? extends java.lang.Boolean>,WeightedBinaryEnsemble<InputType,Evaluator<? super InputType,? extends java.lang.Boolean>>>
protected void addEnsembleMember(Evaluator<? super InputType,? extends java.lang.Boolean> member)
AbstractBaggingLearner
addEnsembleMember
in class AbstractBaggingLearner<InputType,java.lang.Boolean,Evaluator<? super InputType,? extends java.lang.Boolean>,WeightedBinaryEnsemble<InputType,Evaluator<? super InputType,? extends java.lang.Boolean>>>
member
- The new member to add to the ensemble.