Package adams.data.evaluator.instance
Class MultiClassifierEvaluator
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.evaluator.instance.AbstractEvaluator
-
- adams.data.evaluator.instance.AbstractSerializableEvaluator
-
- adams.data.evaluator.instance.MultiClassifierEvaluator
-
- All Implemented Interfaces:
adams.core.CleanUpHandler
,adams.core.Destroyable
,adams.core.GlobalInfoSupporter
,adams.core.logging.LoggingLevelHandler
,adams.core.logging.LoggingSupporter
,adams.core.option.OptionHandler
,adams.core.Randomizable
,adams.core.SerializableObject
,adams.core.ShallowCopySupporter<Evaluator>
,adams.core.SizeOfHandler
,adams.core.Stoppable
,adams.core.StoppableWithFeedback
,Evaluator
,Serializable
,Comparable
public class MultiClassifierEvaluator extends AbstractSerializableEvaluator implements adams.core.Randomizable, adams.core.StoppableWithFeedback
Multi-classifier based evaluator. Generates predictions for each of the classifiers on an incoming instance. Outputs info on the range of the predictions, and uses base classifier MAE to normalise the RESULT_SCORE
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-missing-evaluation <float> (property: missingEvaluation) The value to use as replacement for missing evaluations. default: -999999.0
-serialization-file <adams.core.io.PlaceholderFile> (property: serializationFile) The file to serialize the generated internal model to. default: ${CWD}
-override-serialized-file <boolean> (property: overrideSerializedFile) If set to true, then any serialized file will be ignored and the setup for serialization will be regenerated. default: false
-classifier <weka.classifiers.Classifier> [-classifier ...] (property: classifiers) The classifiers to be used. default: weka.classifiers.functions.PLSClassifier -filter \"weka.filters.supervised.attribute.PLSFilter -C 20 -M -A PLS1 -P center\" -S 1
-base <weka.classifiers.Classifier> (property: base) The base classifier to be used. default: weka.classifiers.functions.PLSClassifier -filter \"weka.filters.supervised.attribute.PLSFilter -C 20 -M -A PLS1 -P center\" -S 1
-seed <long> (property: seed) The seed value to use for cross-validation default: 1
-folds <int> (property: folds) The number of folds to use default: 10 minimum: 2
- Version:
- $Revision: 7 $
- Author:
- dale
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected weka.classifiers.Classifier
m_Base
WEKA base classifier to use.protected weka.classifiers.Classifier[]
m_Classifiers
WEKA classifiers to use.protected weka.classifiers.Evaluation
m_CrossvalidationResults
the results.protected int
m_Folds
the number of folds.protected weka.core.Instances
m_Header
Header of instances to process.protected long
m_Seed
the seed value.protected boolean
m_Stopped
whether the execution was stopped.protected weka.core.Instances
m_TrainingData
Instances for training bags.-
Fields inherited from class adams.data.evaluator.instance.AbstractSerializableEvaluator
m_OverrideSerializationFile, m_SerializableObjectHelper, m_SerializationFile
-
Fields inherited from class adams.data.evaluator.instance.AbstractEvaluator
DEFAULT_METRIC, m_MissingEvaluation
-
-
Constructor Summary
Constructors Constructor Description MultiClassifierEvaluator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
baseTipText()
Returns the tip text for this property.String
classifiersTipText()
Returns the tip text for this property.void
cleanUp()
Clean up training instances.void
defineOptions()
Adds options to the internal list of options.String
foldsTipText()
Returns the tip text for this property.weka.classifiers.Classifier
getBase()
Get the base classifier to be used.weka.classifiers.Classifier[]
getClassifiers()
Get the classifiers to be used.weka.core.Instances
getData()
Get training data.protected float
getDefaultMissingEvaluation()
Returns the default value in case of missing evaluations.int
getFolds()
Returns the number of folds in use.long
getSeed()
Returns the seed value.String
globalInfo()
Global info.void
initSerializationSetup()
Regenerates all the objects that are necessary for serialization.boolean
isStopped()
Whether the execution has been stopped.protected boolean
performBuild(weka.core.Instances data)
Builds the evaluator.protected Float
performEvaluate(weka.core.Instance data)
Get predictions for each of the models.protected HashMap<String,Float>
performMultiEvaluate(weka.core.Instance data)
Performs the actual evaluation, allowing return of multiple evaluation metrics.Object[]
retrieveSerializationSetup()
Returns the member variables to serialize to a file.String
seedTipText()
Returns the tip text for this property.void
setBase(weka.classifiers.Classifier value)
Set the base classifier to be used.void
setClassifiers(weka.classifiers.Classifier[] value)
Set the classifiers to be used.void
setData(weka.core.Instances value)
Set training data.void
setFolds(int value)
Sets the number of folds to use (>= 2).void
setSeed(long value)
Sets the seed value.void
setSerializationSetup(Object[] value)
Updates the member variables with the provided objects obtained from deserialization.void
stopExecution()
Stops the execution.-
Methods inherited from class adams.data.evaluator.instance.AbstractSerializableEvaluator
destroy, getOverrideSerializedFile, getSerializationFile, initialize, isSetupLoadedOrGenerated, overrideSerializedFileTipText, preCheck, reset, serializationFileTipText, setLoggingLevel, setOverrideSerializedFile, setSerializationFile, setSetupLoadedOrGenerated
-
Methods inherited from class adams.data.evaluator.instance.AbstractEvaluator
build, compareTo, equals, evaluate, forCommandLine, forName, getEvaluators, getMissingEvaluation, missingEvaluationTipText, preCheck, setMissingEvaluation, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
m_Classifiers
protected weka.classifiers.Classifier[] m_Classifiers
WEKA classifiers to use.
-
m_Base
protected weka.classifiers.Classifier m_Base
WEKA base classifier to use.
-
m_Seed
protected long m_Seed
the seed value.
-
m_Folds
protected int m_Folds
the number of folds.
-
m_TrainingData
protected weka.core.Instances m_TrainingData
Instances for training bags.
-
m_CrossvalidationResults
protected weka.classifiers.Evaluation m_CrossvalidationResults
the results.
-
m_Header
protected weka.core.Instances m_Header
Header of instances to process.
-
m_Stopped
protected boolean m_Stopped
whether the execution was stopped.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Global info.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classadams.core.option.AbstractOptionHandler
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classAbstractSerializableEvaluator
-
getDefaultMissingEvaluation
protected float getDefaultMissingEvaluation()
Returns the default value in case of missing evaluations.- Specified by:
getDefaultMissingEvaluation
in classAbstractEvaluator
- Returns:
- the default value
-
setClassifiers
public void setClassifiers(weka.classifiers.Classifier[] value)
Set the classifiers to be used.- Parameters:
value
- the classifiers
-
getClassifiers
public weka.classifiers.Classifier[] getClassifiers()
Get the classifiers to be used.- Returns:
- the classifiers
-
classifiersTipText
public String classifiersTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setBase
public void setBase(weka.classifiers.Classifier value)
Set the base classifier to be used.- Parameters:
value
- the base classifier
-
getBase
public weka.classifiers.Classifier getBase()
Get the base classifier to be used.- Returns:
- the base classifier
-
baseTipText
public String baseTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setSeed
public void setSeed(long value)
Sets the seed value.- Specified by:
setSeed
in interfaceadams.core.Randomizable
- Parameters:
value
- the seed
-
getSeed
public long getSeed()
Returns the seed value.- Specified by:
getSeed
in interfaceadams.core.Randomizable
- Returns:
- the seed
-
seedTipText
public String seedTipText()
Returns the tip text for this property.- Specified by:
seedTipText
in interfaceadams.core.Randomizable
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFolds
public void setFolds(int value)
Sets the number of folds to use (>= 2).- Parameters:
value
- the folds
-
getFolds
public int getFolds()
Returns the number of folds in use.- Returns:
- the folds
-
foldsTipText
public String foldsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setData
public void setData(weka.core.Instances value)
Set training data.- Parameters:
value
- the data
-
getData
public weka.core.Instances getData()
Get training data.- Returns:
- training instances
-
performMultiEvaluate
protected HashMap<String,Float> performMultiEvaluate(weka.core.Instance data)
Performs the actual evaluation, allowing return of multiple evaluation metrics.- Overrides:
performMultiEvaluate
in classAbstractEvaluator
- Parameters:
data
- the instance to check- Returns:
- evaluation metrics,
AbstractEvaluator.m_MissingEvaluation
in case the class value is missing
-
performEvaluate
protected Float performEvaluate(weka.core.Instance data)
Get predictions for each of the models.- Overrides:
performEvaluate
in classAbstractEvaluator
- Parameters:
data
- instance- Returns:
- measure
-
initSerializationSetup
public void initSerializationSetup()
Regenerates all the objects that are necessary for serialization.- Specified by:
initSerializationSetup
in interfaceadams.core.SerializableObject
-
retrieveSerializationSetup
public Object[] retrieveSerializationSetup()
Returns the member variables to serialize to a file.- Specified by:
retrieveSerializationSetup
in interfaceadams.core.SerializableObject
- Returns:
- the objects to serialize
-
setSerializationSetup
public void setSerializationSetup(Object[] value)
Updates the member variables with the provided objects obtained from deserialization.- Specified by:
setSerializationSetup
in interfaceadams.core.SerializableObject
- Parameters:
value
- the deserialized objects
-
performBuild
protected boolean performBuild(weka.core.Instances data)
Builds the evaluator.- Specified by:
performBuild
in classAbstractEvaluator
- Parameters:
data
- the instance to check- Returns:
- true if build successful
-
cleanUp
public void cleanUp()
Clean up training instances.- Specified by:
cleanUp
in interfaceadams.core.CleanUpHandler
-
stopExecution
public void stopExecution()
Stops the execution. No message set.- Specified by:
stopExecution
in interfaceadams.core.Stoppable
-
isStopped
public boolean isStopped()
Whether the execution has been stopped.- Specified by:
isStopped
in interfaceadams.core.StoppableWithFeedback
- Returns:
- true if stopped
-
-