Package weka.classifiers.meta
Class AbstainAttributePercentile
- java.lang.Object
-
- weka.classifiers.AbstractClassifier
-
- weka.classifiers.SingleClassifierEnhancer
-
- weka.classifiers.meta.AbstainAttributePercentile
-
- 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 AbstainAttributePercentile extends weka.classifiers.SingleClassifierEnhancer implements weka.core.WeightedInstancesHandler, AbstainingClassifier
Only predict if attribute value within percentile range. Ensure same for training set if req.- Version:
- $Revision$
- Author:
- Dale
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
m_attnum
protected weka.core.Instances
m_Data
protected boolean
m_debug
protected double
m_max
protected double
m_min
protected boolean
m_ok
protected double
m_pctile
protected Range
m_Range
protected Hashtable<Integer,double[]>
m_Ranges
the ranges (attribute index <-> double[]).protected boolean
m_removetrain
-
Constructor Summary
Constructors Constructor Description AbstainAttributePercentile()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
attributeTipText()
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.String
getAttribute()
weka.core.Capabilities
getCapabilities()
Returns default capabilities of the base classifier.String[]
getOptions()
Gets the current option settings for the OptionHandler.double
getPercentile()
boolean
getRemoveTrain()
String
getRevision()
String
globalInfo()
Returns a string describing classifier.Enumeration
listOptions()
Returns an enumeration describing the available options.static void
main(String[] argv)
Main method for running this class.String
percentileTipText()
String
removeTrainTipText()
void
setAttribute(String at)
void
setOptions(String[] options)
Sets the OptionHandler's options using the given list.void
setPercentile(double var)
void
setRemoveTrain(boolean t)
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
-
m_Data
protected weka.core.Instances m_Data
-
m_attnum
protected int m_attnum
-
m_debug
protected boolean m_debug
-
m_pctile
protected double m_pctile
-
m_ok
protected boolean m_ok
-
m_removetrain
protected boolean m_removetrain
-
m_min
protected double m_min
-
m_max
protected double m_max
-
m_Range
protected Range m_Range
-
-
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
Sets the OptionHandler's options using the given list. All options will be set (or reset) during this call (i.e. incremental setting of options is not possible). Valid options are:
-D If set, classifier is run in debug mode and may output additional info to the console
-W Full name of base classifier. (default: weka.classifiers.rules.ZeroR)
Options specific to classifier weka.classifiers.rules.ZeroR:
-D If set, classifier is run in debug mode and may output additional info to the console
-S <sint> Number of regressions (default: 10)
-P <int> Percent sample size (default: 60)
-E <int> Percent Error at (default: 50)
-G <seed> Set the seed used to generate samples (default: 0)
- 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 option settings for the OptionHandler.- Specified by:
getOptions
in interfaceweka.core.OptionHandler
- Overrides:
getOptions
in classweka.classifiers.SingleClassifierEnhancer
- Returns:
- the list of current option settings as an array of strings
-
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 something goes wrong
-
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
- Throws:
Exception
-
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
-
setPercentile
public void setPercentile(double var)
-
getPercentile
public double getPercentile()
-
percentileTipText
public String percentileTipText()
-
setAttribute
public void setAttribute(String at)
-
getAttribute
public String getAttribute()
-
attributeTipText
public String attributeTipText()
-
setRemoveTrain
public void setRemoveTrain(boolean t)
-
getRemoveTrain
public boolean getRemoveTrain()
-
removeTrainTipText
public String removeTrainTipText()
-
main
public static void main(String[] argv)
Main method for running this class.- Parameters:
argv
- the options
-
-