Package adams.data.weka.evaluator
Class IntervalEstimatorBased
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.weka.evaluator.AbstractInstanceEvaluator
-
- adams.data.weka.evaluator.AbstractDatasetInstanceEvaluator
-
- adams.data.weka.evaluator.AbstractCrossvalidatedInstanceEvaluator<IntervalEstimatorBased.SortedInterval>
-
- adams.data.weka.evaluator.IntervalEstimatorBased
-
- 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.SizeOfHandler
,Serializable
public class IntervalEstimatorBased extends AbstractCrossvalidatedInstanceEvaluator<IntervalEstimatorBased.SortedInterval>
Uses a classifier that produces confidence intervals. ???
Valid options are:
-D <int> (property: debugLevel) The greater the number the more additional info the scheme may output to the console (0 = off). default: 0 minimum: 0
-threshold <double> (property: threshold) The threshold percentage to use (0-1). default: 0.75
-folds <int> (property: folds) The number of folds to use for cross-validation; cross-validation gets turned off below a value of 2. default: 2
-seed <int> (property: seed) The seed value for randomizing the data for cross-validation. default: 1
-classifier <weka.classifiers.Classifier [options]> (property: classifier) The classifier to use (must implement weka.classifiers.IntervalEstimator ). default: weka.classifiers.functions.GaussianProcesses -L 1.0 -N 0 -K \"weka.classifiers.functions.supportVector.PolyKernel -C 250007 -E 1.0\"
-level <double> (property: confidenceLevel) The confidence level to use when generating the confidence intervals (0- 1). default: 0.95
-relative (property: relativeWidths) If set to true, then the calculated widths will be relative ones, as they will get divided by the class value of the Instance.
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IntervalEstimatorBased.SortedInterval
Helper class for sorting the confidence intervals.-
Nested classes/interfaces inherited from class adams.data.weka.evaluator.AbstractCrossvalidatedInstanceEvaluator
AbstractCrossvalidatedInstanceEvaluator.EvaluationContainer
-
-
Field Summary
Fields Modifier and Type Field Description protected weka.classifiers.Classifier
m_Classifier
the IntervalEstimator to use.protected double
m_ConfidenceLevel
the confidence level.protected double
m_MaxWidth
the maximum width allowed.protected double
m_MinWidth
the minimum width encountered.protected boolean
m_RelativeWidths
whether to divide the calculated widths by the class value.-
Fields inherited from class adams.data.weka.evaluator.AbstractCrossvalidatedInstanceEvaluator
m_Folds, m_Seed
-
Fields inherited from class adams.data.weka.evaluator.AbstractDatasetInstanceEvaluator
m_Data, m_Threshold
-
Fields inherited from class adams.data.weka.evaluator.AbstractInstanceEvaluator
m_Initialized
-
-
Constructor Summary
Constructors Constructor Description IntervalEstimatorBased()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static double
calcAverageWidth(double[][] array)
Calculates the average width of the intervals.protected static double
calcWidth(double[] array)
Calculates the width of the interval.String
classifierTipText()
Returns the tip text for this property.String
confidenceLevelTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected double
doEvaluate(weka.core.Instance inst)
Performs the actual evaluation.protected Vector<IntervalEstimatorBased.SortedInterval>
evaluate(weka.core.Instances train, weka.core.Instances test)
Performs an evaluation on the given train and test set.protected String
findThreshold(Vector<IntervalEstimatorBased.SortedInterval> evals)
Finds the threshold based on the collected data.weka.classifiers.Classifier
getClassifier()
Returns the classifier.double
getConfidenceLevel()
Returns the confidence level.boolean
getRelativeWidths()
Returns whether the calculated widths are divided by the class value.String
globalInfo()
Returns a string describing the object.String
relativeWidthsTipText()
Returns the tip text for this property.void
setClassifier(weka.classifiers.Classifier value)
Sets the classifier to use, must implement weka.classifiers.IntervalEstimator.void
setConfidenceLevel(double value)
Sets the confidence level.void
setRelativeWidths(boolean value)
Sets whether to divide the calculated widths by the class value.-
Methods inherited from class adams.data.weka.evaluator.AbstractCrossvalidatedInstanceEvaluator
findThreshold, foldsTipText, getFolds, getSeed, seedTipText, setFolds, setSeed
-
Methods inherited from class adams.data.weka.evaluator.AbstractDatasetInstanceEvaluator
cleanUp, getData, getThreshold, reset, setData, setThreshold, setUp, split, thresholdTipText
-
Methods inherited from class adams.data.weka.evaluator.AbstractInstanceEvaluator
check, compareTo, destroy, equals, evaluate, forCommandLine, forName, getEvaluators, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
m_Classifier
protected weka.classifiers.Classifier m_Classifier
the IntervalEstimator to use.
-
m_ConfidenceLevel
protected double m_ConfidenceLevel
the confidence level.
-
m_RelativeWidths
protected boolean m_RelativeWidths
whether to divide the calculated widths by the class value.
-
m_MaxWidth
protected double m_MaxWidth
the maximum width allowed.
-
m_MinWidth
protected double m_MinWidth
the minimum width encountered.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in 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:
defineOptions
in interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classAbstractCrossvalidatedInstanceEvaluator<IntervalEstimatorBased.SortedInterval>
-
setClassifier
public void setClassifier(weka.classifiers.Classifier value)
Sets the classifier to use, must implement weka.classifiers.IntervalEstimator.- Parameters:
value
- the classifier
-
getClassifier
public weka.classifiers.Classifier getClassifier()
Returns the classifier.- Returns:
- the classifier
-
classifierTipText
public String classifierTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setConfidenceLevel
public void setConfidenceLevel(double value)
Sets the confidence level.- Parameters:
value
- the confidence level (0-1)
-
getConfidenceLevel
public double getConfidenceLevel()
Returns the confidence level.- Returns:
- the confidence level (0-1)
-
confidenceLevelTipText
public String confidenceLevelTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setRelativeWidths
public void setRelativeWidths(boolean value)
Sets whether to divide the calculated widths by the class value.- Parameters:
value
- if true then the widths will get divided by the class value (= relative)
-
getRelativeWidths
public boolean getRelativeWidths()
Returns whether the calculated widths are divided by the class value.- Returns:
- trye if the widths are divided by the class value
-
relativeWidthsTipText
public String relativeWidthsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
findThreshold
protected String findThreshold(Vector<IntervalEstimatorBased.SortedInterval> evals)
Finds the threshold based on the collected data.- Specified by:
findThreshold
in classAbstractCrossvalidatedInstanceEvaluator<IntervalEstimatorBased.SortedInterval>
- Parameters:
evals
- the collected evaluation containers- Returns:
- null if everything OK, error message otherwise
-
evaluate
protected Vector<IntervalEstimatorBased.SortedInterval> evaluate(weka.core.Instances train, weka.core.Instances test)
Performs an evaluation on the given train and test set.- Specified by:
evaluate
in classAbstractCrossvalidatedInstanceEvaluator<IntervalEstimatorBased.SortedInterval>
- Parameters:
train
- the training settest
- the test set- Returns:
- the generated evaluation container
-
doEvaluate
protected double doEvaluate(weka.core.Instance inst)
Performs the actual evaluation.- Specified by:
doEvaluate
in classAbstractInstanceEvaluator
- Parameters:
inst
- the instance to evaluate- Returns:
- evaluation range, between 0 and 1 (0 = bad, 1 = good, -1 = if unable to evaluate)
-
calcWidth
protected static double calcWidth(double[] array)
Calculates the width of the interval.- Parameters:
array
- the lower and upper bound- Returns:
- the width
-
calcAverageWidth
protected static double calcAverageWidth(double[][] array)
Calculates the average width of the intervals.- Parameters:
array
- the arrayw with the lower and upper bounds- Returns:
- the average width
-
-