gov.sandia.cognition.learning.algorithm.ensemble
Class BinaryBaggingLearner<InputType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.algorithm.AbstractIterativeAlgorithm
          extended by gov.sandia.cognition.algorithm.AbstractAnytimeAlgorithm<ResultType>
              extended by gov.sandia.cognition.learning.algorithm.AbstractAnytimeBatchLearner<Collection<? extends InputOutputPair<? extends InputType,OutputType>>,ResultType>
                  extended by gov.sandia.cognition.learning.algorithm.AbstractAnytimeSupervisedBatchLearner<InputType,OutputType,EnsembleType>
                      extended by gov.sandia.cognition.learning.algorithm.ensemble.AbstractBaggingLearner<InputType,Boolean,Evaluator<? super InputType,? extends Boolean>,WeightedBinaryEnsemble<InputType,Evaluator<? super InputType,? extends Boolean>>>
                          extended by gov.sandia.cognition.learning.algorithm.ensemble.BinaryBaggingLearner<InputType>
Type Parameters:
InputType - Input class of the Collection<InputOutputPairs> for the dataset, for example, something like Vector or String
All Implemented Interfaces:
AnytimeAlgorithm<WeightedBinaryEnsemble<InputType,Evaluator<? super InputType,? extends Boolean>>>, IterativeAlgorithm, StoppableAlgorithm, AnytimeBatchLearner<Collection<? extends InputOutputPair<? extends InputType,Boolean>>,WeightedBinaryEnsemble<InputType,Evaluator<? super InputType,? extends Boolean>>>, BatchLearner<Collection<? extends InputOutputPair<? extends InputType,Boolean>>,WeightedBinaryEnsemble<InputType,Evaluator<? super InputType,? extends Boolean>>>, BatchLearnerContainer<BatchLearner<? super Collection<? extends InputOutputPair<? extends InputType,Boolean>>,? extends Evaluator<? super InputType,? extends Boolean>>>, SupervisedBatchLearner<InputType,Boolean,WeightedBinaryEnsemble<InputType,Evaluator<? super InputType,? extends Boolean>>>, CloneableSerializable, Randomized, Serializable, Cloneable

@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,Boolean,Evaluator<? super InputType,? extends Boolean>,WeightedBinaryEnsemble<InputType,Evaluator<? super InputType,? extends Boolean>>>

The 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.

Since:
2.0
Author:
Justin Basilico
See Also:
Serialized Form

Field Summary
 
Fields inherited from class gov.sandia.cognition.learning.algorithm.ensemble.AbstractBaggingLearner
bag, dataInBag, dataList, DEFAULT_MAX_ITERATIONS, DEFAULT_PERCENT_TO_SAMPLE, ensemble, learner, percentToSample, random
 
Fields inherited from class gov.sandia.cognition.learning.algorithm.AbstractAnytimeBatchLearner
data, keepGoing
 
Fields inherited from class gov.sandia.cognition.algorithm.AbstractAnytimeAlgorithm
maxIterations
 
Fields inherited from class gov.sandia.cognition.algorithm.AbstractIterativeAlgorithm
DEFAULT_ITERATION, iteration
 
Constructor Summary
BinaryBaggingLearner()
          Creates a new instance of BinaryBaggingLearner.
BinaryBaggingLearner(BatchLearner<? super Collection<? extends InputOutputPair<? extends InputType,Boolean>>,? extends Evaluator<? super InputType,? extends Boolean>> learner)
          Creates a new instance of BinaryBaggingLearner.
BinaryBaggingLearner(BatchLearner<? super Collection<? extends InputOutputPair<? extends InputType,Boolean>>,? extends Evaluator<? super InputType,? extends Boolean>> learner, int maxIterations)
          Creates a new instance of BinaryBaggingLearner.
BinaryBaggingLearner(BatchLearner<? super Collection<? extends InputOutputPair<? extends InputType,Boolean>>,? extends Evaluator<? super InputType,? extends Boolean>> learner, int maxIterations, double percentToSample, Random random)
          Creates a new instance of BinaryBaggingLearner.
BinaryBaggingLearner(BatchLearner<? super Collection<? extends InputOutputPair<? extends InputType,Boolean>>,? extends Evaluator<? super InputType,? extends Boolean>> learner, int maxIterations, Random random)
          Creates a new instance of BinaryBaggingLearner.
 
Method Summary
protected  void addEnsembleMember(Evaluator<? super InputType,? extends Boolean> member)
          Adds a new member to the ensemble.
protected  WeightedBinaryEnsemble<InputType,Evaluator<? super InputType,? extends Boolean>> createInitialEnsemble()
          Create the initial, empty ensemble for the algorithm to use.
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.ensemble.AbstractBaggingLearner
cleanupAlgorithm, fillBag, getBag, getDataInBag, getDataList, getEnsemble, getLearner, getPercentToSample, getRandom, getResult, initializeAlgorithm, setBag, setDataInBag, setDataList, setEnsemble, setLearner, setPercentToSample, setRandom, step
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.AbstractAnytimeBatchLearner
clone, getData, getKeepGoing, learn, setData, setKeepGoing, stop
 
Methods inherited from class gov.sandia.cognition.algorithm.AbstractAnytimeAlgorithm
getMaxIterations, isResultValid, setMaxIterations
 
Methods inherited from class gov.sandia.cognition.algorithm.AbstractIterativeAlgorithm
addIterativeAlgorithmListener, fireAlgorithmEnded, fireAlgorithmStarted, fireStepEnded, fireStepStarted, getIteration, getListeners, removeIterativeAlgorithmListener, setIteration, setListeners
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.learning.algorithm.BatchLearner
learn
 
Methods inherited from interface gov.sandia.cognition.util.CloneableSerializable
clone
 
Methods inherited from interface gov.sandia.cognition.algorithm.AnytimeAlgorithm
getMaxIterations, setMaxIterations
 
Methods inherited from interface gov.sandia.cognition.algorithm.IterativeAlgorithm
addIterativeAlgorithmListener, getIteration, removeIterativeAlgorithmListener
 
Methods inherited from interface gov.sandia.cognition.algorithm.StoppableAlgorithm
isResultValid
 

Constructor Detail

BinaryBaggingLearner

public BinaryBaggingLearner()
Creates a new instance of BinaryBaggingLearner.


BinaryBaggingLearner

public BinaryBaggingLearner(BatchLearner<? super Collection<? extends InputOutputPair<? extends InputType,Boolean>>,? extends Evaluator<? super InputType,? extends Boolean>> learner)
Creates a new instance of BinaryBaggingLearner.

Parameters:
learner - The learner to use to create the categorizer on each iteration.

BinaryBaggingLearner

public BinaryBaggingLearner(BatchLearner<? super Collection<? extends InputOutputPair<? extends InputType,Boolean>>,? extends Evaluator<? super InputType,? extends Boolean>> learner,
                            int maxIterations)
Creates a new instance of BinaryBaggingLearner.

Parameters:
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.

BinaryBaggingLearner

public BinaryBaggingLearner(BatchLearner<? super Collection<? extends InputOutputPair<? extends InputType,Boolean>>,? extends Evaluator<? super InputType,? extends Boolean>> learner,
                            int maxIterations,
                            Random random)
Creates a new instance of BinaryBaggingLearner.

Parameters:
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.

BinaryBaggingLearner

public BinaryBaggingLearner(BatchLearner<? super Collection<? extends InputOutputPair<? extends InputType,Boolean>>,? extends Evaluator<? super InputType,? extends Boolean>> learner,
                            int maxIterations,
                            double percentToSample,
                            Random random)
Creates a new instance of BinaryBaggingLearner.

Parameters:
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.
Method Detail

createInitialEnsemble

protected WeightedBinaryEnsemble<InputType,Evaluator<? super InputType,? extends Boolean>> createInitialEnsemble()
Description copied from class: AbstractBaggingLearner
Create the initial, empty ensemble for the algorithm to use.

Specified by:
createInitialEnsemble in class AbstractBaggingLearner<InputType,Boolean,Evaluator<? super InputType,? extends Boolean>,WeightedBinaryEnsemble<InputType,Evaluator<? super InputType,? extends Boolean>>>
Returns:
A new ensemble for the algorithm to use.

addEnsembleMember

protected void addEnsembleMember(Evaluator<? super InputType,? extends Boolean> member)
Description copied from class: AbstractBaggingLearner
Adds a new member to the ensemble.

Specified by:
addEnsembleMember in class AbstractBaggingLearner<InputType,Boolean,Evaluator<? super InputType,? extends Boolean>,WeightedBinaryEnsemble<InputType,Evaluator<? super InputType,? extends Boolean>>>
Parameters:
member - The new member to add to the ensemble.