Package moa.classifiers.meta
Class HeterogeneousEnsembleAbstract
- java.lang.Object
-
- moa.AbstractMOAObject
-
- moa.options.AbstractOptionHandler
-
- moa.classifiers.AbstractClassifier
-
- moa.classifiers.meta.HeterogeneousEnsembleAbstract
-
- All Implemented Interfaces:
Configurable
,Serializable
,CapabilitiesHandler
,Classifier
,MultiClassClassifier
,AWTRenderable
,Learner<Example<Instance>>
,MOAObject
,OptionHandler
- Direct Known Subclasses:
HeterogeneousEnsembleBlast
,HeterogeneousEnsembleBlastFadingFactors
public abstract class HeterogeneousEnsembleAbstract extends AbstractClassifier implements MultiClassClassifier
BLAST (Best Last) for Heterogeneous Ensembles Abstract Base ClassGiven a set of (heterogeneous) classifiers, BLAST builds an ensemble, and determines the weights of all ensemble members based on their performance on recent observed instances. Used as Abstact Base Class for HeterogeneousEnsembleBlast and HeterogeneousEnsembleBlastFadingFactors.
J. N. van Rijn, G. Holmes, B. Pfahringer, J. Vanschoren. Having a Blast: Meta-Learning and Heterogeneous Ensembles for Data Streams. In 2015 IEEE International Conference on Data Mining, pages 1003-1008. IEEE, 2015.
Parameters:
- -b : Comma-separated string of classifiers
- -g : Grace period (1 = optimal)
- -k : Number of active classifiers
- Version:
- $Revision: 1 $
- Author:
- Jan N. van Rijn (j.n.van.rijn@liacs.leidenuniv.nl)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description IntOption
activeClassifiersOption
ListOption
baselearnersOption
protected Classifier[]
ensemble
IntOption
gracePerionOption
protected double[]
historyTotal
protected Integer
instancesSeen
FlagOption
weightClassifiersOption
-
Fields inherited from class moa.classifiers.AbstractClassifier
classifierRandom, modelContext, randomSeed, randomSeedOption, trainingWeightSeenByModel
-
Fields inherited from class moa.options.AbstractOptionHandler
config
-
-
Constructor Summary
Constructors Constructor Description HeterogeneousEnsembleAbstract()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getEnsembleSize()
String
getMemberCliString(int idx)
void
getModelDescription(StringBuilder arg0, int arg1)
Returns a string representation of the model.protected Measurement[]
getModelMeasurementsImpl()
Gets the current measurements of this classifier.
The reason for ...Impl methods: ease programmer burden by not requiring them to remember calls to super in overridden methods.String
getPurposeString()
Dictionary with option texts and objectsdouble[]
getVotesForInstance(Instance inst)
Predicts the class memberships for a given instance.boolean
isRandomizable()
Gets whether this learner needs a random seed.protected static int
maxIndex(double[] scores)
protected static double[]
normalize(double[] input)
void
prepareForUseImpl(TaskMonitor monitor, ObjectRepository repository)
This method describes the implementation of how to prepare this object for use.void
setModelContext(InstancesHeader ih)
Sets the reference to the header of the data stream.protected static List<Integer>
topK(double[] scores, int k)
-
Methods inherited from class moa.classifiers.AbstractClassifier
contextIsCompatible, copy, correctlyClassifies, defineImmutableCapabilities, getAttributeNameString, getAWTRenderer, getClassLabelString, getClassNameString, getDescription, getModel, getModelContext, getModelMeasurements, getNominalValueString, getPredictionForInstance, getPredictionForInstance, getSubClassifiers, getSublearners, getVotesForInstance, modelAttIndexToInstanceAttIndex, modelAttIndexToInstanceAttIndex, resetLearning, resetLearningImpl, setRandomSeed, trainingHasStarted, trainingWeightSeenByModel, trainOnInstance, trainOnInstance, trainOnInstanceImpl
-
Methods inherited from class moa.options.AbstractOptionHandler
getCLICreationString, getOptions, getPreparedClassOption, prepareClassOptions, prepareForUse, prepareForUse
-
Methods inherited from class moa.AbstractMOAObject
copy, measureByteSize, measureByteSize, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface moa.capabilities.CapabilitiesHandler
getCapabilities
-
Methods inherited from interface moa.MOAObject
measureByteSize
-
Methods inherited from interface moa.options.OptionHandler
getCLICreationString, getOptions, prepareForUse, prepareForUse
-
-
-
-
Field Detail
-
baselearnersOption
public ListOption baselearnersOption
-
gracePerionOption
public IntOption gracePerionOption
-
activeClassifiersOption
public IntOption activeClassifiersOption
-
weightClassifiersOption
public FlagOption weightClassifiersOption
-
ensemble
protected Classifier[] ensemble
-
historyTotal
protected double[] historyTotal
-
instancesSeen
protected Integer instancesSeen
-
-
Method Detail
-
getPurposeString
public String getPurposeString()
Description copied from class:AbstractOptionHandler
Dictionary with option texts and objects- Specified by:
getPurposeString
in interfaceOptionHandler
- Overrides:
getPurposeString
in classAbstractClassifier
- Returns:
- the string with the purpose of this object
-
getEnsembleSize
public int getEnsembleSize()
-
getMemberCliString
public String getMemberCliString(int idx)
-
getVotesForInstance
public double[] getVotesForInstance(Instance inst)
Description copied from interface:Classifier
Predicts the class memberships for a given instance. If an instance is unclassified, the returned array elements must be all zero.- Specified by:
getVotesForInstance
in interfaceClassifier
- Specified by:
getVotesForInstance
in classAbstractClassifier
- Parameters:
inst
- the instance to be classified- Returns:
- an array containing the estimated membership probabilities of the test instance in each class
-
setModelContext
public void setModelContext(InstancesHeader ih)
Description copied from interface:Learner
Sets the reference to the header of the data stream. The header of the data stream is extended from WEKAInstances
. This header is needed to know the number of classes and attributes- Specified by:
setModelContext
in interfaceLearner<Example<Instance>>
- Overrides:
setModelContext
in classAbstractClassifier
- Parameters:
ih
- the reference to the data stream header
-
isRandomizable
public boolean isRandomizable()
Description copied from interface:Learner
Gets whether this learner needs a random seed. Examples of methods that needs a random seed are bagging and boosting.- Specified by:
isRandomizable
in interfaceLearner<Example<Instance>>
- Returns:
- true if the learner needs a random seed.
-
getModelDescription
public void getModelDescription(StringBuilder arg0, int arg1)
Description copied from class:AbstractClassifier
Returns a string representation of the model.- Specified by:
getModelDescription
in classAbstractClassifier
- Parameters:
arg0
- the stringbuilder to add the descriptionarg1
- the number of characters to indent
-
getModelMeasurementsImpl
protected Measurement[] getModelMeasurementsImpl()
Description copied from class:AbstractClassifier
Gets the current measurements of this classifier.
The reason for ...Impl methods: ease programmer burden by not requiring them to remember calls to super in overridden methods. Note that this will produce compiler errors if not overridden.- Specified by:
getModelMeasurementsImpl
in classAbstractClassifier
- Returns:
- an array of measurements to be used in evaluation tasks
-
prepareForUseImpl
public void prepareForUseImpl(TaskMonitor monitor, ObjectRepository repository)
Description copied from class:AbstractOptionHandler
This method describes the implementation of how to prepare this object for use. All classes that extends this class have to implementprepareForUseImpl
and notprepareForUse
sinceprepareForUse
callsprepareForUseImpl
.- Overrides:
prepareForUseImpl
in classAbstractClassifier
- Parameters:
monitor
- the TaskMonitor to userepository
- the ObjectRepository to use
-
maxIndex
protected static int maxIndex(double[] scores)
-
normalize
protected static double[] normalize(double[] input)
-
-