public class AccuracyUpdatedEnsemble extends AbstractClassifier
Modifier and Type | Field and Description |
---|---|
protected Classifier |
candidate
Candidate classifier.
|
IntOption |
chunkSizeOption
Chunk size.
|
protected long[] |
classDistributions
Class distributions.
|
protected weka.core.Instances |
currentChunk
Current chunk of instances.
|
ClassOption |
learnerOption
Type of classifier to use as a component classifier.
|
protected Classifier[] |
learners
Ensemble classifiers.
|
IntOption |
maxByteSizeOption
Determines the maximum size of model (evaluated after every chunk).
|
IntOption |
memberCountOption
Number of component classifiers.
|
protected int |
processedInstances
Number of processed examples.
|
protected double[][] |
weights
The weights of stored classifiers.
|
classifierRandom, modelContext, randomSeed, randomSeedOption, trainingWeightSeenByModel
classOptionNamesToPreparedObjects, options
Constructor and Description |
---|
AccuracyUpdatedEnsemble() |
Modifier and Type | Method and Description |
---|---|
protected Classifier |
addToStored(Classifier newClassifier,
double newClassifiersWeight)
Adds a classifier to the storage.
|
protected double |
computeMse(Classifier learner,
weka.core.Instances chunk)
Computes the MSE of a learner for a given chunk of examples.
|
protected double |
computeMseR()
Computes the MSEr threshold.
|
protected void |
enforceMemoryLimit()
Checks if the memory limit is exceeded and if so prunes the classifiers in the ensemble.
|
void |
getModelDescription(StringBuilder out,
int indent)
Returns a string representation of the model.
|
protected Measurement[] |
getModelMeasurementsImpl()
Adds ensemble weights to the measurements.
|
Classifier[] |
getSubClassifiers()
Gets the classifiers of this ensemble.
|
double[] |
getVotesForInstance(weka.core.Instance inst)
Predicts a class for an example.
|
boolean |
isRandomizable()
Determines whether the classifier is randomizable.
|
void |
prepareForUseImpl(TaskMonitor monitor,
ObjectRepository repository)
This method describes the implementation of how to prepare this object for use.
|
protected void |
processChunk()
Processes a chunk of instances.
|
void |
resetLearningImpl()
Resets this classifier.
|
void |
trainOnInstanceImpl(weka.core.Instance inst)
Trains this classifier incrementally using the given instance.
The reason for ...Impl methods: ease programmer burden by not requiring them to remember calls to super in overridden methods. |
contextIsCompatible, copy, correctlyClassifies, getAttributeNameString, getAWTRenderer, getClassLabelString, getClassNameString, getDescription, getModelContext, getModelMeasurements, getNominalValueString, getPurposeString, modelAttIndexToInstanceAttIndex, modelAttIndexToInstanceAttIndex, resetLearning, setModelContext, setRandomSeed, trainingHasStarted, trainingWeightSeenByModel, trainOnInstance
discoverOptionsViaReflection, getCLICreationString, getOptions, getPreparedClassOption, getPreparedClassOption, prepareClassOptions, prepareForUse, prepareForUse
copy, measureByteSize, measureByteSize, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getCLICreationString, getOptions, prepareForUse, prepareForUse
measureByteSize
public ClassOption learnerOption
public IntOption memberCountOption
public IntOption chunkSizeOption
public IntOption maxByteSizeOption
protected double[][] weights
protected long[] classDistributions
protected Classifier[] learners
protected int processedInstances
protected Classifier candidate
protected weka.core.Instances currentChunk
public void prepareForUseImpl(TaskMonitor monitor, ObjectRepository repository)
AbstractOptionHandler
prepareForUseImpl
and not prepareForUse
since
prepareForUse
calls prepareForUseImpl
.prepareForUseImpl
in class AbstractClassifier
monitor
- the TaskMonitor to userepository
- the ObjectRepository to usepublic void resetLearningImpl()
AbstractClassifier
resetLearningImpl
in class AbstractClassifier
public void trainOnInstanceImpl(weka.core.Instance inst)
AbstractClassifier
trainOnInstanceImpl
in class AbstractClassifier
inst
- the instance to be used for trainingpublic boolean isRandomizable()
public double[] getVotesForInstance(weka.core.Instance inst)
inst
- the instance to be classifiedpublic void getModelDescription(StringBuilder out, int indent)
AbstractClassifier
getModelDescription
in class AbstractClassifier
out
- the stringbuilder to add the descriptionindent
- the number of characters to indentpublic Classifier[] getSubClassifiers()
Classifier
getSubClassifiers
in interface Classifier
getSubClassifiers
in class AbstractClassifier
protected void processChunk()
protected void enforceMemoryLimit()
protected double computeMseR()
protected double computeMse(Classifier learner, weka.core.Instances chunk)
learner
- classifier to compute errorchunk
- chunk of examplesprotected Measurement[] getModelMeasurementsImpl()
getModelMeasurementsImpl
in class AbstractClassifier
protected Classifier addToStored(Classifier newClassifier, double newClassifiersWeight)
newClassifier
- The classifier to add.newClassifiersWeight
- The new classifiers weight.Copyright © 2014 University of Waikato, Hamilton, NZ. All Rights Reserved.