Package moa.evaluation
Class BasicClassificationPerformanceEvaluator
- java.lang.Object
-
- moa.AbstractMOAObject
-
- moa.options.AbstractOptionHandler
-
- moa.evaluation.BasicClassificationPerformanceEvaluator
-
- All Implemented Interfaces:
Configurable
,Serializable
,CapabilitiesHandler
,ClassificationPerformanceEvaluator
,LearningPerformanceEvaluator<Example<Instance>>
,MOAObject
,OptionHandler
- Direct Known Subclasses:
AdwinClassificationPerformanceEvaluator
,EWMAClassificationPerformanceEvaluator
,FadingFactorClassificationPerformanceEvaluator
,WindowClassificationPerformanceEvaluator
public class BasicClassificationPerformanceEvaluator extends AbstractOptionHandler implements ClassificationPerformanceEvaluator
Classification evaluator that performs basic incremental evaluation.- Version:
- $Revision: 8 $
- Author:
- Richard Kirkby (rkirkby@cs.waikato.ac.nz), Albert Bifet (abifet at cs dot waikato dot ac dot nz) Updates in September 15th 2017 to include precision, recall and F1 scores., Jean Karax (karaxjr@gmail.com), Jean Paul Barddal (jean.barddal@ppgia.pucpr.br), Wilson Sasaki Jr (sasaki.wilson.jr@gmail.com)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
BasicClassificationPerformanceEvaluator.BasicEstimator
static interface
BasicClassificationPerformanceEvaluator.Estimator
-
Field Summary
Fields Modifier and Type Field Description protected BasicClassificationPerformanceEvaluator.Estimator[]
columnKappa
FlagOption
f1PerClassOption
protected int
numClasses
protected BasicClassificationPerformanceEvaluator.Estimator[]
precision
FlagOption
precisionPerClassOption
FlagOption
precisionRecallOutputOption
protected BasicClassificationPerformanceEvaluator.Estimator[]
recall
FlagOption
recallPerClassOption
protected BasicClassificationPerformanceEvaluator.Estimator[]
rowKappa
protected BasicClassificationPerformanceEvaluator.Estimator
weightCorrect
-
Fields inherited from class moa.options.AbstractOptionHandler
config
-
-
Constructor Summary
Constructors Constructor Description BasicClassificationPerformanceEvaluator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addResult(Example<Instance> example, double[] classVotes)
Adds a learning result to this evaluator.void
addResult(Example<Instance> testInst, Prediction prediction)
ImmutableCapabilities
defineImmutableCapabilities()
Defines the set of capabilities the object has.void
getDescription(StringBuilder sb, int indent)
Returns a string representation of this object.double
getF1Statistic()
double
getF1Statistic(int numClass)
double
getFractionCorrectlyClassified()
double
getFractionIncorrectlyClassified()
double
getKappaStatistic()
double
getKappaTemporalStatistic()
Measurement[]
getPerformanceMeasurements()
Gets the current measurements monitored by this evaluator.double
getPrecisionStatistic()
double
getPrecisionStatistic(int numClass)
double
getRecallStatistic()
double
getRecallStatistic(int numClass)
double
getTotalWeightObserved()
protected BasicClassificationPerformanceEvaluator.Estimator
newEstimator()
protected void
prepareForUseImpl(TaskMonitor monitor, ObjectRepository repository)
This method describes the implementation of how to prepare this object for use.void
reset()
Resets this evaluator.void
reset(int numClasses)
-
Methods inherited from class moa.options.AbstractOptionHandler
copy, getCLICreationString, getOptions, getPreparedClassOption, getPurposeString, 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
-
-
-
-
Field Detail
-
weightCorrect
protected BasicClassificationPerformanceEvaluator.Estimator weightCorrect
-
columnKappa
protected BasicClassificationPerformanceEvaluator.Estimator[] columnKappa
-
rowKappa
protected BasicClassificationPerformanceEvaluator.Estimator[] rowKappa
-
precision
protected BasicClassificationPerformanceEvaluator.Estimator[] precision
-
recall
protected BasicClassificationPerformanceEvaluator.Estimator[] recall
-
numClasses
protected int numClasses
-
precisionRecallOutputOption
public FlagOption precisionRecallOutputOption
-
precisionPerClassOption
public FlagOption precisionPerClassOption
-
recallPerClassOption
public FlagOption recallPerClassOption
-
f1PerClassOption
public FlagOption f1PerClassOption
-
-
Method Detail
-
reset
public void reset()
Description copied from interface:LearningPerformanceEvaluator
Resets this evaluator. It must be similar to starting a new evaluator from scratch.- Specified by:
reset
in interfaceLearningPerformanceEvaluator<Example<Instance>>
-
reset
public void reset(int numClasses)
-
addResult
public void addResult(Example<Instance> example, double[] classVotes)
Description copied from interface:LearningPerformanceEvaluator
Adds a learning result to this evaluator.- Specified by:
addResult
in interfaceLearningPerformanceEvaluator<Example<Instance>>
- Parameters:
example
- the example to be classifiedclassVotes
- an array containing the estimated membership probabilities of the test instance in each class
-
getPerformanceMeasurements
public Measurement[] getPerformanceMeasurements()
Description copied from interface:LearningPerformanceEvaluator
Gets the current measurements monitored by this evaluator.- Specified by:
getPerformanceMeasurements
in interfaceLearningPerformanceEvaluator<Example<Instance>>
- Returns:
- an array of measurements monitored by this evaluator
-
getTotalWeightObserved
public double getTotalWeightObserved()
-
getFractionCorrectlyClassified
public double getFractionCorrectlyClassified()
-
getFractionIncorrectlyClassified
public double getFractionIncorrectlyClassified()
-
getKappaStatistic
public double getKappaStatistic()
-
getKappaTemporalStatistic
public double getKappaTemporalStatistic()
-
getPrecisionStatistic
public double getPrecisionStatistic()
-
getPrecisionStatistic
public double getPrecisionStatistic(int numClass)
-
getRecallStatistic
public double getRecallStatistic()
-
getRecallStatistic
public double getRecallStatistic(int numClass)
-
getF1Statistic
public double getF1Statistic()
-
getF1Statistic
public double getF1Statistic(int numClass)
-
getDescription
public void getDescription(StringBuilder sb, int indent)
Description copied from interface:MOAObject
Returns a string representation of this object. Used inAbstractMOAObject.toString
to give a string representation of the object.- Specified by:
getDescription
in interfaceMOAObject
- Parameters:
sb
- the stringbuilder to add the descriptionindent
- the number of characters to indent
-
addResult
public void addResult(Example<Instance> testInst, Prediction prediction)
- Specified by:
addResult
in interfaceLearningPerformanceEvaluator<Example<Instance>>
-
prepareForUseImpl
protected 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
.- Specified by:
prepareForUseImpl
in classAbstractOptionHandler
- Parameters:
monitor
- the TaskMonitor to userepository
- the ObjectRepository to use
-
newEstimator
protected BasicClassificationPerformanceEvaluator.Estimator newEstimator()
-
defineImmutableCapabilities
public ImmutableCapabilities defineImmutableCapabilities()
Description copied from interface:CapabilitiesHandler
Defines the set of capabilities the object has. Should be overridden if the object's capabilities do not change.- Specified by:
defineImmutableCapabilities
in interfaceCapabilitiesHandler
- Specified by:
defineImmutableCapabilities
in interfaceLearningPerformanceEvaluator<Example<Instance>>
- Returns:
- The capabilities of the object.
-
-