Class ALUncertainty
- java.lang.Object
-
- moa.AbstractMOAObject
-
- moa.options.AbstractOptionHandler
-
- moa.classifiers.AbstractClassifier
-
- moa.classifiers.active.ALUncertainty
-
- All Implemented Interfaces:
Configurable
,Serializable
,CapabilitiesHandler
,ALClassifier
,Classifier
,AWTRenderable
,Learner<Example<Instance>>
,MOAObject
,OptionHandler
public class ALUncertainty extends AbstractClassifier implements ALClassifier
Active learning setting for evolving data streams.Active learning focuses on learning an accurate model with as few labels as possible. Streaming data poses additional challenges for active learning, since the data distribution may change over time (concept drift) and classifiers need to adapt. Conventional active learning strategies concentrate on querying the most uncertain instances, which are typically concentrated around the decision boundary. If changes do not occur close to the boundary, they will be missed and classifiers will fail to adapt. This class contains three active learning strategies for streaming data that explicitly handle concept drift. They are based on fixed uncertainty, dynamic allocation of labeling efforts over time and randomization of the search space [ZBPH]. It also contains the Selective Sampling strategy, which is adapted from [CGZ] and uses a variable labeling threshold.
[ZBPH] Indre Zliobaite, Albert Bifet, Bernhard Pfahringer, Geoff Holmes: Active Learning with Evolving Streaming Data. ECML/PKDD (3) 2011: 597-612
[CGZ] N. Cesa-Bianchi, C. Gentile, and L. Zaniboni. Worst-case analysis of selective sampling for linear classification. J. Mach. Learn. Res. (7) 2006: 1205-1230
.Parameters:
- -l : Classifier to train
- -d : Strategy to use: FixedUncertainty, VarUncertainty, RandVarUncertainty, SelSampling
- -b : Budget to use
- -u : Fixed threshold
- -s : Floating budget step
- -n : Number of instances at beginning without active learning
Structural changes to match active learning framework by Daniel Kottke.
- Version:
- $Revision: 7 $
- Author:
- Indre Zliobaite (zliobaite at gmail dot com), Albert Bifet (abifet at cs dot waikato dot ac dot nz), Daniel Kottke (daniel dot kottke at ovgu dot de) - adapted to AL framework
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description double
accuracyBaseLearner
MultiChoiceOption
activeLearningStrategyOption
ClassOption
baseLearnerOption
FloatOption
budgetOption
Classifier
classifier
int
costLabeling
FloatOption
fixedThresholdOption
int
iterationControl
int
lastLabelAcq
double
maxPosterior
double
newThreshold
FloatOption
numInstancesInitOption
FloatOption
stepOption
-
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 ALUncertainty()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getLastLabelAcqReport()
Returns true if the previously chosen instance was added to the training set of the active learner.void
getModelDescription(StringBuilder out, int indent)
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.void
resetLearningImpl()
Resets this classifier.void
setModelContext(InstancesHeader ih)
Sets the reference to the header of the data stream.void
trainOnInstanceImpl(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.-
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, prepareForUseImpl, resetLearning, setRandomSeed, trainingHasStarted, trainingWeightSeenByModel, trainOnInstance, trainOnInstance
-
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.gui.AWTRenderable
getAWTRenderer
-
Methods inherited from interface moa.capabilities.CapabilitiesHandler
getCapabilities
-
Methods inherited from interface moa.classifiers.Classifier
copy, correctlyClassifies, getPredictionForInstance, getSubClassifiers, trainOnInstance
-
Methods inherited from interface moa.learners.Learner
getModel, getModelContext, getModelMeasurements, getPredictionForInstance, getSublearners, getVotesForInstance, resetLearning, setRandomSeed, trainingHasStarted, trainingWeightSeenByModel, trainOnInstance
-
Methods inherited from interface moa.MOAObject
getDescription, measureByteSize
-
Methods inherited from interface moa.options.OptionHandler
getCLICreationString, getOptions, prepareForUse, prepareForUse
-
-
-
-
Field Detail
-
baseLearnerOption
public ClassOption baseLearnerOption
-
activeLearningStrategyOption
public MultiChoiceOption activeLearningStrategyOption
-
budgetOption
public FloatOption budgetOption
-
fixedThresholdOption
public FloatOption fixedThresholdOption
-
stepOption
public FloatOption stepOption
-
numInstancesInitOption
public FloatOption numInstancesInitOption
-
classifier
public Classifier classifier
-
lastLabelAcq
public int lastLabelAcq
-
costLabeling
public int costLabeling
-
iterationControl
public int iterationControl
-
newThreshold
public double newThreshold
-
maxPosterior
public double maxPosterior
-
accuracyBaseLearner
public double accuracyBaseLearner
-
-
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
-
resetLearningImpl
public void resetLearningImpl()
Description copied from class:AbstractClassifier
Resets this classifier. It must be similar to starting a new classifier from scratch.
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:
resetLearningImpl
in classAbstractClassifier
-
trainOnInstanceImpl
public void trainOnInstanceImpl(Instance inst)
Description copied from class:AbstractClassifier
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. Note that this will produce compiler errors if not overridden.- Specified by:
trainOnInstanceImpl
in classAbstractClassifier
- Parameters:
inst
- the instance to be used for training
-
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
-
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 out, int indent)
Description copied from class:AbstractClassifier
Returns a string representation of the model.- Specified by:
getModelDescription
in classAbstractClassifier
- Parameters:
out
- the stringbuilder to add the descriptionindent
- 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
-
getLastLabelAcqReport
public int getLastLabelAcqReport()
Description copied from interface:ALClassifier
Returns true if the previously chosen instance was added to the training set of the active learner.- Specified by:
getLastLabelAcqReport
in interfaceALClassifier
-
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
-
-