gov.sandia.cognition.learning.algorithm.ensemble
Class IVotingCategorizerLearner.OutOfBagErrorStoppingCriteria<InputType,CategoryType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.algorithm.event.AbstractIterativeAlgorithmListener
          extended by gov.sandia.cognition.learning.algorithm.ensemble.IVotingCategorizerLearner.OutOfBagErrorStoppingCriteria<InputType,CategoryType>
Type Parameters:
InputType - The input type the algorithm is learning over.
CategoryType - The category type the algorithm is learning over.
All Implemented Interfaces:
IterativeAlgorithmListener, CloneableSerializable, Serializable, Cloneable
Enclosing class:
IVotingCategorizerLearner<InputType,CategoryType>

public static class IVotingCategorizerLearner.OutOfBagErrorStoppingCriteria<InputType,CategoryType>
extends AbstractIterativeAlgorithmListener

Implements a stopping criteria for IVoting that uses the out-of-bag error to determine when to stop learning the ensemble. It tracks the out-of-bag error rate of the ensemble and keeps it in a given smoothing window. Once the smoothed error rate stops decreasing, it stops learning and removes all of the ensemble members back to the one that had the minimal error in that window.

See Also:
Serialized Form

Field Summary
static int DEFAULT_SMOOTHING_WINDOW_SIZE
          The default smoothing window size is 25.
protected  IVotingCategorizerLearner<InputType,CategoryType> learner
          The learner the stopping criteria is for.
protected  boolean[] outOfBagCorrect
          A boolean for each example indicating whether or not it is currently a correct or incorrect out-of-bag vote.
protected  int outOfBagErrorCount
          The total number of out-of-bag errors.
protected  double previousSmoothedErrorRate
          The smoothed error rate of the previous iteration.
protected  ArrayList<Double> rawErrorRates
          The raw out-of-bag error rate, per iteration.
protected  ArrayList<Double> smoothedErrorRates
          The smoothed out-of-bag error rates, per iteration.
protected  FiniteCapacityBuffer<Double> smoothingBuffer
          The buffer used for smoothing.
protected  int smoothingWindowSize
          The size of window of data to look at to determine if learning has hit a minimum.
 
Constructor Summary
IVotingCategorizerLearner.OutOfBagErrorStoppingCriteria()
          Creates a new OutOfBagErrorStoppingCriteria.
IVotingCategorizerLearner.OutOfBagErrorStoppingCriteria(int smoothingWindowSize)
          Creates a new OutOfBagErrorStoppingCriteria with the given smoothing window size.
 
Method Summary
 void algorithmEnded(IterativeAlgorithm algorithm)
          This method is called when the algorithm has ended, after the last step of the algorithm.
 void algorithmStarted(IterativeAlgorithm algorithm)
          This method is called when a algorithm has started, before the first step of the algorithm.
 int getSmoothingWindowSize()
          Gets the size of the smoothing window.
 void setSmoothingWindowSize(int smoothingWindowSize)
          Sets the smoothing window size.
 void stepEnded(IterativeAlgorithm algorithm)
          This method is called when the algorithm has ended a step of its execution.
 
Methods inherited from class gov.sandia.cognition.algorithm.event.AbstractIterativeAlgorithmListener
stepStarted
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SMOOTHING_WINDOW_SIZE

public static final int DEFAULT_SMOOTHING_WINDOW_SIZE
The default smoothing window size is 25.

See Also:
Constant Field Values

smoothingWindowSize

protected int smoothingWindowSize
The size of window of data to look at to determine if learning has hit a minimum.


learner

protected transient IVotingCategorizerLearner<InputType,CategoryType> learner
The learner the stopping criteria is for.


outOfBagCorrect

protected transient boolean[] outOfBagCorrect
A boolean for each example indicating whether or not it is currently a correct or incorrect out-of-bag vote. This should be the same size as the collection of data.


outOfBagErrorCount

protected transient int outOfBagErrorCount
The total number of out-of-bag errors. This should equal the number of false values in the outOfBagCorrect array.


rawErrorRates

protected transient ArrayList<Double> rawErrorRates
The raw out-of-bag error rate, per iteration.


smoothedErrorRates

protected transient ArrayList<Double> smoothedErrorRates
The smoothed out-of-bag error rates, per iteration.


smoothingBuffer

protected transient FiniteCapacityBuffer<Double> smoothingBuffer
The buffer used for smoothing.


previousSmoothedErrorRate

protected transient double previousSmoothedErrorRate
The smoothed error rate of the previous iteration.

Constructor Detail

IVotingCategorizerLearner.OutOfBagErrorStoppingCriteria

public IVotingCategorizerLearner.OutOfBagErrorStoppingCriteria()
Creates a new OutOfBagErrorStoppingCriteria.


IVotingCategorizerLearner.OutOfBagErrorStoppingCriteria

public IVotingCategorizerLearner.OutOfBagErrorStoppingCriteria(int smoothingWindowSize)
Creates a new OutOfBagErrorStoppingCriteria with the given smoothing window size.

Parameters:
smoothingWindowSize - The smoothing window size to use. Must be positive.
Method Detail

algorithmStarted

public void algorithmStarted(IterativeAlgorithm algorithm)
Description copied from interface: IterativeAlgorithmListener
This method is called when a algorithm has started, before the first step of the algorithm.

Specified by:
algorithmStarted in interface IterativeAlgorithmListener
Overrides:
algorithmStarted in class AbstractIterativeAlgorithmListener
Parameters:
algorithm - The algorithm that has started.

algorithmEnded

public void algorithmEnded(IterativeAlgorithm algorithm)
Description copied from interface: IterativeAlgorithmListener
This method is called when the algorithm has ended, after the last step of the algorithm.

Specified by:
algorithmEnded in interface IterativeAlgorithmListener
Overrides:
algorithmEnded in class AbstractIterativeAlgorithmListener
Parameters:
algorithm - The algorithm that has ended.

stepEnded

public void stepEnded(IterativeAlgorithm algorithm)
Description copied from interface: IterativeAlgorithmListener
This method is called when the algorithm has ended a step of its execution.

Specified by:
stepEnded in interface IterativeAlgorithmListener
Overrides:
stepEnded in class AbstractIterativeAlgorithmListener
Parameters:
algorithm - The algorithm that has ended another step of its execution.

getSmoothingWindowSize

public int getSmoothingWindowSize()
Gets the size of the smoothing window.

Returns:
The size of the smoothing window.

setSmoothingWindowSize

public void setSmoothingWindowSize(int smoothingWindowSize)
Sets the smoothing window size.

Parameters:
smoothingWindowSize - The smoothing window size. Must be positive.