Package weka.classifiers.meta
Class MinMaxLimits
- java.lang.Object
-
- weka.classifiers.AbstractClassifier
-
- weka.classifiers.SingleClassifierEnhancer
-
- weka.classifiers.meta.MinMaxLimits
-
- All Implemented Interfaces:
Serializable,Cloneable,AbstainingClassifier,weka.classifiers.Classifier,weka.core.BatchPredictor,weka.core.CapabilitiesHandler,weka.core.CapabilitiesIgnorer,weka.core.CommandlineRunnable,weka.core.OptionHandler,weka.core.RevisionHandler,weka.core.WeightedInstancesHandler
public class MinMaxLimits extends weka.classifiers.SingleClassifierEnhancer implements weka.core.WeightedInstancesHandler, AbstainingClassifier
Allows to influence the handling of lower/upper limits of the built classifier when making predictions.
The following types of handling are available: AS_IS, MANUAL, CLASS_RANGE
Details on the types:
- AS_IS: prediction does not get changed
- MANUAL: applies the manual limit, ie at most this limit is output
- CLASS_RANGE: applies the percentage leeway to the class attribute range of the training set to determine the actual limit value. Valid options are:-min-handling <AS_IS|MANUAL|CLASS_RANGE> How the lower limit is handled. (default: AS_IS)
-min-manual <num> The manual lower limit (default: 0.0)
-min-class-percentage <num> The class range percentage leeway for the lower limit 0-1 = 0-100% (default: 0.0)
-max-handling <AS_IS|MANUAL|CLASS_RANGE> How the upper limit is handled. (default: AS_IS)
-max-manual <num> The manual upper limit (default: 0.0)
-max-class-percentage <num> The class range percentage leeway for the upper limit 0-1 = 0-100% (default: 0.0)
-W Full name of base classifier. (default: weka.classifiers.rules.ZeroR)
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
Options specific to classifier weka.classifiers.rules.ZeroR:
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMinMaxLimits.LimitHandlingDetermines the type of handling for the limit
-
Field Summary
Fields Modifier and Type Field Description static doubleDEFAULT_MAX_CLASS_RANGE_PERCENTAGEthe default class range percentage for the lower limit.static MinMaxLimits.LimitHandlingDEFAULT_MAX_HANDLINGthe default handling of the lower limit.static doubleDEFAULT_MAX_MANUALthe default manual limit of the lower limit.static doubleDEFAULT_MIN_CLASS_RANGE_PERCENTAGEthe default class range percentage for the lower limit.static MinMaxLimits.LimitHandlingDEFAULT_MIN_HANDLINGthe default handling of the lower limit.static doubleDEFAULT_MIN_MANUALthe default manual limit of the lower limit.protected booleanm_CanAbstainwhether the base classifier can abstain.protected Doublem_MaxActualthe actual limit to use for the upper limit.protected doublem_MaxClassRangePercentagethe percentage leeway for the class range of the upper limit (0-1 = 0-100%).protected MinMaxLimits.LimitHandlingm_MaxHandlinghow the upper limit is handled.protected doublem_MaxManualthe manual limit for the upper limit.protected Doublem_MinActualthe actual limit to use for the lower limit.protected doublem_MinClassRangePercentagethe percentage leeway for the class range of the lower limit (0-1 = 0-100%).protected MinMaxLimits.LimitHandlingm_MinHandlinghow the lower limit is handled.protected doublem_MinManualthe manual limit for the lower limit.
-
Constructor Summary
Constructors Constructor Description MinMaxLimits()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuildClassifier(weka.core.Instances data)Builds the classifier.booleancanAbstain()Whether abstaining is possible, e.g., used in meta-classifiers.doubleclassifyInstance(weka.core.Instance inst)Returns the prediction.doublegetAbstentionClassification(weka.core.Instance inst)The prediction that made the classifier abstain.double[]getAbstentionDistribution(weka.core.Instance inst)The class distribution that made the classifier abstain.weka.core.CapabilitiesgetCapabilities()Returns default capabilities of the base classifier.doublegetMaxClassRangePercentage()Get the percentage of leeway to apply to the upper limit determaxed by the range of the class attribute in the training data.MinMaxLimits.LimitHandlinggetMaxHandling()Get how the upper limit is handled.doublegetMaxManual()Get the manual upper limit.doublegetMinClassRangePercentage()Get the percentage of leeway to apply to the lower limit determined by the range of the class attribute in the training data.MinMaxLimits.LimitHandlinggetMinHandling()Get how the lower limit is handled.doublegetMinManual()Get the manual lower limit.String[]getOptions()Gets the current settings of the classifier.StringgetRevision()StringglobalInfo()Returns a string describing classifier.EnumerationlistOptions()Returns an enumeration describing the available options.static voidmain(String[] args)Main method for running this class.StringmaxClassRangePercentageTipText()Returns the tip text for this property.StringmaxHandlingTipText()Returns the tip text for this property.StringmaxManualTipText()Returns the tip text for this property.StringminClassRangePercentageTipText()Returns the tip text for this property.StringminHandlingTipText()Returns the tip text for this property.StringminManualTipText()Returns the tip text for this property.voidsetMaxClassRangePercentage(double value)Set the percentage of leeway to apply to the upper limit determaxed by the range of the class attribute in the training data.voidsetMaxHandling(MinMaxLimits.LimitHandling value)Set how the upper limit is handled.voidsetMaxManual(double value)Set the manual upper limit.voidsetMinClassRangePercentage(double value)Set the percentage of leeway to apply to the lower limit determined by the range of the class attribute in the training data.voidsetMinHandling(MinMaxLimits.LimitHandling value)Set how the lower limit is handled.voidsetMinManual(double value)Set the manual lower limit.voidsetOptions(String[] options)Parses a given list of options.StringtoString()Returns description of classifier.-
Methods inherited from class weka.classifiers.SingleClassifierEnhancer
classifierTipText, defaultClassifierOptions, defaultClassifierString, getClassifier, getClassifierSpec, postExecution, preExecution, setClassifier
-
Methods inherited from class weka.classifiers.AbstractClassifier
batchSizeTipText, debugTipText, distributionForInstance, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
-
-
-
-
Field Detail
-
DEFAULT_MIN_HANDLING
public static final MinMaxLimits.LimitHandling DEFAULT_MIN_HANDLING
the default handling of the lower limit.
-
DEFAULT_MIN_MANUAL
public static final double DEFAULT_MIN_MANUAL
the default manual limit of the lower limit.- See Also:
- Constant Field Values
-
DEFAULT_MIN_CLASS_RANGE_PERCENTAGE
public static final double DEFAULT_MIN_CLASS_RANGE_PERCENTAGE
the default class range percentage for the lower limit.- See Also:
- Constant Field Values
-
DEFAULT_MAX_HANDLING
public static final MinMaxLimits.LimitHandling DEFAULT_MAX_HANDLING
the default handling of the lower limit.
-
DEFAULT_MAX_MANUAL
public static final double DEFAULT_MAX_MANUAL
the default manual limit of the lower limit.- See Also:
- Constant Field Values
-
DEFAULT_MAX_CLASS_RANGE_PERCENTAGE
public static final double DEFAULT_MAX_CLASS_RANGE_PERCENTAGE
the default class range percentage for the lower limit.- See Also:
- Constant Field Values
-
m_MinHandling
protected MinMaxLimits.LimitHandling m_MinHandling
how the lower limit is handled.
-
m_MinManual
protected double m_MinManual
the manual limit for the lower limit.
-
m_MinClassRangePercentage
protected double m_MinClassRangePercentage
the percentage leeway for the class range of the lower limit (0-1 = 0-100%).
-
m_MinActual
protected Double m_MinActual
the actual limit to use for the lower limit.
-
m_MaxHandling
protected MinMaxLimits.LimitHandling m_MaxHandling
how the upper limit is handled.
-
m_MaxManual
protected double m_MaxManual
the manual limit for the upper limit.
-
m_MaxClassRangePercentage
protected double m_MaxClassRangePercentage
the percentage leeway for the class range of the upper limit (0-1 = 0-100%).
-
m_MaxActual
protected Double m_MaxActual
the actual limit to use for the upper limit.
-
m_CanAbstain
protected boolean m_CanAbstain
whether the base classifier can abstain.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing classifier.- Returns:
- a description suitable for displaying in the explorer/experimenter gui
-
listOptions
public Enumeration listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceweka.core.OptionHandler- Overrides:
listOptionsin classweka.classifiers.SingleClassifierEnhancer- Returns:
- an enumeration of all the available options.
-
setOptions
public void setOptions(String[] options) throws Exception
Parses a given list of options.- Specified by:
setOptionsin interfaceweka.core.OptionHandler- Overrides:
setOptionsin classweka.classifiers.SingleClassifierEnhancer- Parameters:
options- the list of options as an array of strings- Throws:
Exception- if an option is not supported
-
getOptions
public String[] getOptions()
Gets the current settings of the classifier.- Specified by:
getOptionsin interfaceweka.core.OptionHandler- Overrides:
getOptionsin classweka.classifiers.SingleClassifierEnhancer- Returns:
- an array of strings suitable for passing to setOptions
-
setMinHandling
public void setMinHandling(MinMaxLimits.LimitHandling value)
Set how the lower limit is handled.- Parameters:
value- how the lower limit is handled
-
getMinHandling
public MinMaxLimits.LimitHandling getMinHandling()
Get how the lower limit is handled.- Returns:
- how the lower limit is handled
-
minHandlingTipText
public String minHandlingTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setMinManual
public void setMinManual(double value)
Set the manual lower limit.- Parameters:
value- the manual lower limit
-
getMinManual
public double getMinManual()
Get the manual lower limit.- Returns:
- the manual lower limit
-
minManualTipText
public String minManualTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setMinClassRangePercentage
public void setMinClassRangePercentage(double value)
Set the percentage of leeway to apply to the lower limit determined by the range of the class attribute in the training data.- Parameters:
value- the percentage (0-1 = 0-100%)
-
getMinClassRangePercentage
public double getMinClassRangePercentage()
Get the percentage of leeway to apply to the lower limit determined by the range of the class attribute in the training data.- Returns:
- the percentage (0-1 = 0-100%)
-
minClassRangePercentageTipText
public String minClassRangePercentageTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setMaxHandling
public void setMaxHandling(MinMaxLimits.LimitHandling value)
Set how the upper limit is handled.- Parameters:
value- how the upper limit is handled
-
getMaxHandling
public MinMaxLimits.LimitHandling getMaxHandling()
Get how the upper limit is handled.- Returns:
- how the upper limit is handled
-
maxHandlingTipText
public String maxHandlingTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setMaxManual
public void setMaxManual(double value)
Set the manual upper limit.- Parameters:
value- the manual upper limit
-
getMaxManual
public double getMaxManual()
Get the manual upper limit.- Returns:
- the manual upper limit
-
maxManualTipText
public String maxManualTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setMaxClassRangePercentage
public void setMaxClassRangePercentage(double value)
Set the percentage of leeway to apply to the upper limit determaxed by the range of the class attribute in the training data.- Parameters:
value- the percentage (0-1 = 0-100%)
-
getMaxClassRangePercentage
public double getMaxClassRangePercentage()
Get the percentage of leeway to apply to the upper limit determaxed by the range of the class attribute in the training data.- Returns:
- the percentage (0-1 = 0-100%)
-
maxClassRangePercentageTipText
public String maxClassRangePercentageTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getCapabilities
public weka.core.Capabilities getCapabilities()
Returns default capabilities of the base classifier.- Specified by:
getCapabilitiesin interfaceweka.core.CapabilitiesHandler- Specified by:
getCapabilitiesin interfaceweka.classifiers.Classifier- Overrides:
getCapabilitiesin classweka.classifiers.SingleClassifierEnhancer- Returns:
- the capabilities of the base classifier
-
buildClassifier
public void buildClassifier(weka.core.Instances data) throws ExceptionBuilds the classifier.- Specified by:
buildClassifierin interfaceweka.classifiers.Classifier- Parameters:
data- the training data- Throws:
Exception- if training fails
-
classifyInstance
public double classifyInstance(weka.core.Instance inst) throws ExceptionReturns the prediction.- Specified by:
classifyInstancein interfaceweka.classifiers.Classifier- Overrides:
classifyInstancein classweka.classifiers.AbstractClassifier- Parameters:
inst- the instance to predict- Returns:
- the prediction
- Throws:
Exception- if prediction fails
-
canAbstain
public boolean canAbstain()
Whether abstaining is possible, e.g., used in meta-classifiers.- Specified by:
canAbstainin interfaceAbstainingClassifier- Returns:
- true if abstaining is possible
-
getAbstentionClassification
public double getAbstentionClassification(weka.core.Instance inst) throws ExceptionThe prediction that made the classifier abstain.- Specified by:
getAbstentionClassificationin interfaceAbstainingClassifier- Parameters:
inst- the instance to get the prediction for- Returns:
- the prediction
- Throws:
Exception- if fails to make prediction
-
getAbstentionDistribution
public double[] getAbstentionDistribution(weka.core.Instance inst) throws ExceptionThe class distribution that made the classifier abstain.- Specified by:
getAbstentionDistributionin interfaceAbstainingClassifier- Parameters:
inst- the instance to get the prediction for- Returns:
- the class distribution
- Throws:
Exception- if fails to make prediction
-
toString
public String toString()
Returns description of classifier.
-
getRevision
public String getRevision()
- Specified by:
getRevisionin interfaceweka.core.RevisionHandler- Overrides:
getRevisionin classweka.classifiers.AbstractClassifier
-
main
public static void main(String[] args)
Main method for running this class.- Parameters:
args- the options
-
-