public class AccuracyWeightedEnsemble extends AbstractClassifier
Modifier and Type | Field and Description |
---|---|
protected Classifier |
candidateClassifier |
protected int |
chunkSize |
IntOption |
chunkSizeOption
Chunk size.
|
protected long[] |
classDistributions |
protected weka.core.Instances |
currentChunk |
protected Classifier[] |
ensemble |
protected double[] |
ensembleWeights |
ClassOption |
learnerOption
Type of classifier to use as a component classifier.
|
protected int |
maxMemberCount |
protected int |
maxStoredCount |
FloatOption |
memberCountOption
Number of component classifiers.
|
protected int |
numFolds |
IntOption |
numFoldsOption
Number of folds in candidate classifier cross-validation.
|
protected int |
processedInstances |
FloatOption |
storedCountOption
Number of classifiers remembered and available for ensemble construction.
|
protected Classifier[] |
storedLearners |
protected double[][] |
storedWeights
The weights of stored classifiers.
|
protected static Comparator<double[]> |
weightComparator
Simple weight comparator.
|
classifierRandom, modelContext, randomSeed, randomSeedOption, trainingWeightSeenByModel
classOptionNamesToPreparedObjects, options
Constructor and Description |
---|
AccuracyWeightedEnsemble() |
Modifier and Type | Method and Description |
---|---|
protected Classifier |
addToStored(Classifier newClassifier,
double newClassifiersWeight)
Adds a classifier to the storage.
|
protected double |
computeCandidateWeight(Classifier candidate,
weka.core.Instances chunk,
int numFolds)
Computes the weight of a candidate classifier.
|
protected double |
computeMseR()
Computes the MSEr threshold.
|
protected double |
computeWeight(Classifier learner,
weka.core.Instances chunk)
Computes the weight of a given classifie.
|
protected void |
discardModel(int index)
Removes the classifier at a given index from the model, thus decreasing
the models size.
|
void |
getModelDescription(StringBuilder out,
int indent)
Returns a string representation of the model.
|
protected Measurement[] |
getModelMeasurementsImpl()
Adds ensemble weights to the measurements.
|
String |
getPurposeString()
Gets the purpose of this object
|
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.
|
protected int |
removePoorestModelBytes()
Removes the poorest classifier from the model, thus decreasing the models
size.
|
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, 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
protected static Comparator<double[]> weightComparator
public ClassOption learnerOption
public FloatOption memberCountOption
public FloatOption storedCountOption
public IntOption chunkSizeOption
public IntOption numFoldsOption
protected long[] classDistributions
protected Classifier[] ensemble
protected Classifier[] storedLearners
protected double[] ensembleWeights
protected double[][] storedWeights
protected int processedInstances
protected int chunkSize
protected int numFolds
protected int maxMemberCount
protected int maxStoredCount
protected Classifier candidateClassifier
protected weka.core.Instances currentChunk
public String getPurposeString()
OptionHandler
getPurposeString
in interface OptionHandler
getPurposeString
in class AbstractClassifier
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 trainingprotected void processChunk()
useMseR
- Determines whether to use the MSEr threshold.protected double computeCandidateWeight(Classifier candidate, weka.core.Instances chunk, int numFolds)
candidate
- Candidate classifier.chunk
- Data chunk of examples.numFolds
- Number of folds in candidate classifier cross-validation.useMseR
- Determines whether to use the MSEr threshold.protected double computeWeight(Classifier learner, weka.core.Instances chunk)
learner
- Classifier to calculate weight for.chunk
- Data chunk of examples.useMseR
- Determines whether to use the MSEr threshold.protected double computeMseR()
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 indentprotected Measurement[] getModelMeasurementsImpl()
getModelMeasurementsImpl
in class AbstractClassifier
public boolean isRandomizable()
public Classifier[] getSubClassifiers()
Classifier
getSubClassifiers
in interface Classifier
getSubClassifiers
in class AbstractClassifier
protected Classifier addToStored(Classifier newClassifier, double newClassifiersWeight)
newClassifier
- The classifier to add.newClassifiersWeight
- The new classifiers weight.protected int removePoorestModelBytes()
protected void discardModel(int index)
index
- Copyright © 2014 University of Waikato, Hamilton, NZ. All Rights Reserved.