Package adams.data.evaluator.instance
Class EnsembleEvaluator
- 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.EnsembleEvaluator
-
- 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 EnsembleEvaluator extends AbstractSerializableEvaluator implements adams.core.Randomizable, adams.core.StoppableWithFeedback
Builds an ensemble of classifiers on the training data to determine the MAE per classifier, to be used as normalization factor.
At evaluation time, each classifier makes a prediction on the instance and the classification is divided by the normalization factor for this classifier. The range between min/max normalized prediction is the evaluation output.
-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 use in the ensemble. default: weka.classifiers.functions.LinearRegressionJ -S 0 -R 1.0E-8
-seed <long> (property: seed) The seed value for the cross-validation. default: 1
-num-folds <int> (property: numFolds) The number of folds to use for evaluating the classifiers. default: 10 minimum: 2
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected weka.classifiers.Classifier[]m_ActualClassifiersthe actual classifiers in use.protected weka.classifiers.Classifier[]m_Classifiersthe classifiers to use.protected weka.classifiers.StoppableEvaluationm_Evaluationthe current evaluation.protected weka.core.Instancesm_Headerthe header.protected double[]m_Normalizethe normalization factor.protected intm_NumFoldsthe number of folds to use for cross-validation.protected longm_Seedthe seed value.protected booleanm_Stoppedwhether the execution was stopped.protected weka.core.Instancesm_TrainingDatathe training data.-
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 EnsembleEvaluator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringclassifiersTipText()Returns the tip text for this property.voidcleanUp()Cleans up data structures, frees up memory.voiddefineOptions()Adds options to the internal list of options.weka.classifiers.Classifier[]getClassifiers()Returns the classifiers in use.protected floatgetDefaultMissingEvaluation()Returns the default value in case of missing evaluations.intgetNumFolds()Returns the number of folds.longgetSeed()Returns the seed value.StringglobalInfo()Returns a string describing the object.voidinitSerializationSetup()Regenerates all the objects that are necessary for serialization.booleanisStopped()Whether the execution has been stopped.StringnumFoldsTipText()Returns the tip text for this property.protected booleanperformBuild(weka.core.Instances data)Builds the evaluator.protected FloatperformEvaluate(weka.core.Instance data)Performs the actual evaluation.Object[]retrieveSerializationSetup()Returns the member variables to serialize to a file.StringseedTipText()Returns the tip text for this property.voidsetClassifiers(weka.classifiers.Classifier[] value)Sets the classifiers to use.voidsetNumFolds(int value)Sets the number of folds.voidsetSeed(long value)Sets the seed value.voidsetSerializationSetup(Object[] value)Updates the member variables with the provided objects obtained from deserialization.voidstopExecution()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, performMultiEvaluate, 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
the classifiers to use.
-
m_ActualClassifiers
protected weka.classifiers.Classifier[] m_ActualClassifiers
the actual classifiers in use.
-
m_Seed
protected long m_Seed
the seed value.
-
m_NumFolds
protected int m_NumFolds
the number of folds to use for cross-validation.
-
m_Normalize
protected double[] m_Normalize
the normalization factor.
-
m_TrainingData
protected weka.core.Instances m_TrainingData
the training data.
-
m_Header
protected weka.core.Instances m_Header
the header.
-
m_Stopped
protected boolean m_Stopped
whether the execution was stopped.
-
m_Evaluation
protected transient weka.classifiers.StoppableEvaluation m_Evaluation
the current evaluation.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceadams.core.GlobalInfoSupporter- Specified by:
globalInfoin classadams.core.option.AbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceadams.core.option.OptionHandler- Overrides:
defineOptionsin classAbstractSerializableEvaluator
-
getDefaultMissingEvaluation
protected float getDefaultMissingEvaluation()
Returns the default value in case of missing evaluations.- Specified by:
getDefaultMissingEvaluationin classAbstractEvaluator- Returns:
- the default value
-
setClassifiers
public void setClassifiers(weka.classifiers.Classifier[] value)
Sets the classifiers to use.- Parameters:
value- the classifiers
-
getClassifiers
public weka.classifiers.Classifier[] getClassifiers()
Returns the classifiers in use.- 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.
-
setSeed
public void setSeed(long value)
Sets the seed value.- Specified by:
setSeedin interfaceadams.core.Randomizable- Parameters:
value- the seed
-
getSeed
public long getSeed()
Returns the seed value.- Specified by:
getSeedin interfaceadams.core.Randomizable- Returns:
- the seed
-
seedTipText
public String seedTipText()
Returns the tip text for this property.- Specified by:
seedTipTextin interfaceadams.core.Randomizable- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setNumFolds
public void setNumFolds(int value)
Sets the number of folds.- Parameters:
value- the number of folds
-
getNumFolds
public int getNumFolds()
Returns the number of folds.- Returns:
- the number of folds
-
numFoldsTipText
public String numFoldsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
performBuild
protected boolean performBuild(weka.core.Instances data)
Builds the evaluator.- Specified by:
performBuildin classAbstractEvaluator- Parameters:
data- the instance to check- Returns:
- true if build successful
-
performEvaluate
protected Float performEvaluate(weka.core.Instance data)
Performs the actual evaluation. Returns the range of the first confidence interval (upper - lower).- Overrides:
performEvaluatein classAbstractEvaluator- Parameters:
data- the instance to check- Returns:
- evaluation metric,
AbstractEvaluator.m_MissingEvaluationin case the class value is missing
-
initSerializationSetup
public void initSerializationSetup()
Regenerates all the objects that are necessary for serialization.- Specified by:
initSerializationSetupin interfaceadams.core.SerializableObject
-
retrieveSerializationSetup
public Object[] retrieveSerializationSetup()
Returns the member variables to serialize to a file.- Specified by:
retrieveSerializationSetupin 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:
setSerializationSetupin interfaceadams.core.SerializableObject- Parameters:
value- the deserialized objects
-
stopExecution
public void stopExecution()
Stops the execution. No message set.- Specified by:
stopExecutionin interfaceadams.core.Stoppable
-
isStopped
public boolean isStopped()
Whether the execution has been stopped.- Specified by:
isStoppedin interfaceadams.core.StoppableWithFeedback- Returns:
- true if stopped
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUpin interfaceadams.core.CleanUpHandler
-
-