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 intm_attnumprotected weka.core.Instancesm_Dataprotected booleanm_debugprotected doublem_maxprotected doublem_minprotected booleanm_okprotected doublem_pctileprotected adams.core.Rangem_Rangeprotected Hashtable<Integer,double[]>m_Rangesthe ranges (attribute index <-> double[]).protected booleanm_removetrain
-
Constructor Summary
Constructors Constructor Description AbstainAttributePercentile()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringattributeTipText()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.StringgetAttribute()weka.core.CapabilitiesgetCapabilities()Returns default capabilities of the base classifier.String[]getOptions()Gets the current option settings for the OptionHandler.doublegetPercentile()booleangetRemoveTrain()StringgetRevision()StringglobalInfo()Returns a string describing classifier.EnumerationlistOptions()Returns an enumeration describing the available options.static voidmain(String[] argv)Main method for running this class.StringpercentileTipText()StringremoveTrainTipText()voidsetAttribute(String at)voidsetOptions(String[] options)Sets the OptionHandler's options using the given list.voidsetPercentile(double var)voidsetRemoveTrain(boolean t)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
-
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 adams.core.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:
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
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:
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 option settings for the OptionHandler.- Specified by:
getOptionsin interfaceweka.core.OptionHandler- Overrides:
getOptionsin 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:
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 something goes wrong
-
classifyInstance
public double classifyInstance(weka.core.Instance inst) throws ExceptionReturns the prediction.- Specified by:
classifyInstancein interfaceweka.classifiers.Classifier- Overrides:
classifyInstancein classweka.classifiers.AbstractClassifier- Throws:
Exception
-
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
-
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
-
-