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 class
MinMaxLimits.LimitHandling
Determines the type of handling for the limit
-
Field Summary
Fields Modifier and Type Field Description static double
DEFAULT_MAX_CLASS_RANGE_PERCENTAGE
the default class range percentage for the lower limit.static MinMaxLimits.LimitHandling
DEFAULT_MAX_HANDLING
the default handling of the lower limit.static double
DEFAULT_MAX_MANUAL
the default manual limit of the lower limit.static double
DEFAULT_MIN_CLASS_RANGE_PERCENTAGE
the default class range percentage for the lower limit.static MinMaxLimits.LimitHandling
DEFAULT_MIN_HANDLING
the default handling of the lower limit.static double
DEFAULT_MIN_MANUAL
the default manual limit of the lower limit.protected boolean
m_CanAbstain
whether the base classifier can abstain.protected Double
m_MaxActual
the actual limit to use for the upper limit.protected double
m_MaxClassRangePercentage
the percentage leeway for the class range of the upper limit (0-1 = 0-100%).protected MinMaxLimits.LimitHandling
m_MaxHandling
how the upper limit is handled.protected double
m_MaxManual
the manual limit for the upper limit.protected Double
m_MinActual
the actual limit to use for the lower limit.protected double
m_MinClassRangePercentage
the percentage leeway for the class range of the lower limit (0-1 = 0-100%).protected MinMaxLimits.LimitHandling
m_MinHandling
how the lower limit is handled.protected double
m_MinManual
the 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 void
buildClassifier(weka.core.Instances data)
Builds the classifier.boolean
canAbstain()
Whether abstaining is possible, e.g., used in meta-classifiers.double
classifyInstance(weka.core.Instance inst)
Returns the prediction.double
getAbstentionClassification(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.Capabilities
getCapabilities()
Returns default capabilities of the base classifier.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.MinMaxLimits.LimitHandling
getMaxHandling()
Get how the upper limit is handled.double
getMaxManual()
Get the manual upper limit.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.MinMaxLimits.LimitHandling
getMinHandling()
Get how the lower limit is handled.double
getMinManual()
Get the manual lower limit.String[]
getOptions()
Gets the current settings of the classifier.String
getRevision()
String
globalInfo()
Returns a string describing classifier.Enumeration
listOptions()
Returns an enumeration describing the available options.static void
main(String[] args)
Main method for running this class.String
maxClassRangePercentageTipText()
Returns the tip text for this property.String
maxHandlingTipText()
Returns the tip text for this property.String
maxManualTipText()
Returns the tip text for this property.String
minClassRangePercentageTipText()
Returns the tip text for this property.String
minHandlingTipText()
Returns the tip text for this property.String
minManualTipText()
Returns the tip text for this property.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.void
setMaxHandling(MinMaxLimits.LimitHandling value)
Set how the upper limit is handled.void
setMaxManual(double value)
Set the manual upper limit.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.void
setMinHandling(MinMaxLimits.LimitHandling value)
Set how the lower limit is handled.void
setMinManual(double value)
Set the manual lower limit.void
setOptions(String[] options)
Parses a given list of options.String
toString()
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:
listOptions
in interfaceweka.core.OptionHandler
- Overrides:
listOptions
in 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:
setOptions
in interfaceweka.core.OptionHandler
- Overrides:
setOptions
in 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:
getOptions
in interfaceweka.core.OptionHandler
- Overrides:
getOptions
in 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:
getCapabilities
in interfaceweka.core.CapabilitiesHandler
- Specified by:
getCapabilities
in interfaceweka.classifiers.Classifier
- Overrides:
getCapabilities
in classweka.classifiers.SingleClassifierEnhancer
- Returns:
- the capabilities of the base classifier
-
buildClassifier
public void buildClassifier(weka.core.Instances data) throws Exception
Builds the classifier.- Specified by:
buildClassifier
in interfaceweka.classifiers.Classifier
- Parameters:
data
- the training data- Throws:
Exception
- if training fails
-
classifyInstance
public double classifyInstance(weka.core.Instance inst) throws Exception
Returns the prediction.- Specified by:
classifyInstance
in interfaceweka.classifiers.Classifier
- Overrides:
classifyInstance
in 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:
canAbstain
in interfaceAbstainingClassifier
- Returns:
- true if abstaining is possible
-
getAbstentionClassification
public double getAbstentionClassification(weka.core.Instance inst) throws Exception
The prediction that made the classifier abstain.- Specified by:
getAbstentionClassification
in 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 Exception
The class distribution that made the classifier abstain.- Specified by:
getAbstentionDistribution
in 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:
getRevision
in interfaceweka.core.RevisionHandler
- Overrides:
getRevision
in classweka.classifiers.AbstractClassifier
-
main
public static void main(String[] args)
Main method for running this class.- Parameters:
args
- the options
-
-