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.public class CategoryBalancedBaggingLearner<InputType,CategoryType> extends BaggingCategorizerLearner<InputType,CategoryType>
BaggingCategorizerLearner.OutOfBagErrorStoppingCriteria<InputType,CategoryType>
Modifier and Type | Field and Description |
---|---|
protected java.util.ArrayList<CategoryType> |
categoryList
The list of categories.
|
protected java.util.HashMap<CategoryType,java.util.ArrayList<java.lang.Integer>> |
dataPerCategory
The mapping of categories to indices of examples belonging to the category.
|
bag, dataInBag, dataList, DEFAULT_MAX_ITERATIONS, DEFAULT_PERCENT_TO_SAMPLE, ensemble, learner, percentToSample, random
data, keepGoing
maxIterations
DEFAULT_ITERATION, iteration
Constructor and Description |
---|
CategoryBalancedBaggingLearner()
Creates a new instance of CategoryBalancedBaggingLearner.
|
CategoryBalancedBaggingLearner(BatchLearner<? super java.util.Collection<? extends InputOutputPair<? extends InputType,CategoryType>>,? extends Evaluator<? super InputType,? extends CategoryType>> learner)
Creates a new instance of CategoryBalancedBaggingLearner.
|
CategoryBalancedBaggingLearner(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 CategoryBalancedBaggingLearner.
|
Modifier and Type | Method and Description |
---|---|
protected void |
cleanupAlgorithm()
Called to clean up the learning algorithm's state after learning has
finished.
|
protected void |
fillBag(int sampleCount)
Fills the internal bag field by sampling the given number of samples.
|
protected boolean |
initializeAlgorithm()
Called to initialize the learning algorithm's state based on the
data that is stored in the data field.
|
addEnsembleMember, createInitialEnsemble, getDataInBag, getExample
getBag, getDataList, getEnsemble, getLearner, getPercentToSample, getRandom, getResult, 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
protected java.util.ArrayList<CategoryType> categoryList
protected java.util.HashMap<CategoryType,java.util.ArrayList<java.lang.Integer>> dataPerCategory
public CategoryBalancedBaggingLearner()
public CategoryBalancedBaggingLearner(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 CategoryBalancedBaggingLearner(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 boolean initializeAlgorithm()
AbstractAnytimeBatchLearner
initializeAlgorithm
in class AbstractBaggingLearner<InputType,CategoryType,Evaluator<? super InputType,? extends CategoryType>,WeightedVotingCategorizerEnsemble<InputType,CategoryType,Evaluator<? super InputType,? extends CategoryType>>>
protected void fillBag(int sampleCount)
AbstractBaggingLearner
fillBag
in class AbstractBaggingLearner<InputType,CategoryType,Evaluator<? super InputType,? extends CategoryType>,WeightedVotingCategorizerEnsemble<InputType,CategoryType,Evaluator<? super InputType,? extends CategoryType>>>
sampleCount
- The number to sample.protected void cleanupAlgorithm()
AbstractAnytimeBatchLearner
cleanupAlgorithm
in class AbstractBaggingLearner<InputType,CategoryType,Evaluator<? super InputType,? extends CategoryType>,WeightedVotingCategorizerEnsemble<InputType,CategoryType,Evaluator<? super InputType,? extends CategoryType>>>