InputType
- The type of the input for the categorizer to learn.CategoryType
- The type of the category that is the output for the categorizer to
learn.public abstract class AbstractCategorizerOutOfBagStoppingCriteria<InputType,CategoryType> extends AbstractIterativeAlgorithmListener
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_SMOOTHING_WINDOW_SIZE
The default smoothing window size is 25.
|
protected BagBasedCategorizerEnsembleLearner<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 java.util.ArrayList<java.lang.Double> |
rawErrorRates
The raw out-of-bag error rate, per iteration.
|
protected java.util.ArrayList<java.lang.Double> |
smoothedErrorRates
The smoothed out-of-bag error rates, per iteration.
|
protected FiniteCapacityBuffer<java.lang.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 and Description |
---|
AbstractCategorizerOutOfBagStoppingCriteria()
Creates a new
OutOfBagErrorStoppingCriteria . |
AbstractCategorizerOutOfBagStoppingCriteria(int smoothingWindowSize)
Creates a new
OutOfBagErrorStoppingCriteria with the given
smoothing window size. |
Modifier and Type | Method and Description |
---|---|
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.
|
abstract DataDistribution<CategoryType> |
getOutOfBagEstimate(int index)
Gets the out-of-bag estimate distribution across categories for the
training example with the given index.
|
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.
|
stepStarted
clone
public static final int DEFAULT_SMOOTHING_WINDOW_SIZE
protected int smoothingWindowSize
protected transient BagBasedCategorizerEnsembleLearner<InputType,CategoryType> learner
protected transient boolean[] outOfBagCorrect
protected transient int outOfBagErrorCount
protected transient java.util.ArrayList<java.lang.Double> rawErrorRates
protected transient java.util.ArrayList<java.lang.Double> smoothedErrorRates
protected transient FiniteCapacityBuffer<java.lang.Double> smoothingBuffer
protected transient double previousSmoothedErrorRate
public AbstractCategorizerOutOfBagStoppingCriteria()
OutOfBagErrorStoppingCriteria
.public AbstractCategorizerOutOfBagStoppingCriteria(int smoothingWindowSize)
OutOfBagErrorStoppingCriteria
with the given
smoothing window size.smoothingWindowSize
- The smoothing window size to use. Must be positive.public void algorithmStarted(IterativeAlgorithm algorithm)
IterativeAlgorithmListener
algorithmStarted
in interface IterativeAlgorithmListener
algorithmStarted
in class AbstractIterativeAlgorithmListener
algorithm
- The algorithm that has started.public void algorithmEnded(IterativeAlgorithm algorithm)
IterativeAlgorithmListener
algorithmEnded
in interface IterativeAlgorithmListener
algorithmEnded
in class AbstractIterativeAlgorithmListener
algorithm
- The algorithm that has ended.public abstract DataDistribution<CategoryType> getOutOfBagEstimate(int index)
index
- The 0-based index for the training example.public void stepEnded(IterativeAlgorithm algorithm)
IterativeAlgorithmListener
stepEnded
in interface IterativeAlgorithmListener
stepEnded
in class AbstractIterativeAlgorithmListener
algorithm
- The algorithm that has ended another step of its execution.public int getSmoothingWindowSize()
public void setSmoothingWindowSize(int smoothingWindowSize)
smoothingWindowSize
- The smoothing window size. Must be positive.