Class 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 adams.core.Range m_Range  
      protected Hashtable<Integer,​double[]> m_Ranges
      the ranges (attribute index <-> double[]).
      protected boolean m_removetrain  
      • Fields inherited from class weka.classifiers.SingleClassifierEnhancer

        m_Classifier
      • Fields inherited from class weka.classifiers.AbstractClassifier

        BATCH_SIZE_DEFAULT, m_BatchSize, m_Debug, m_DoNotCheckCapabilities, m_numDecimalPlaces, NUM_DECIMAL_PLACES_DEFAULT
    • 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_Ranges

        protected Hashtable<Integer,​double[]> m_Ranges
        the ranges (attribute index <-> double[]).
      • m_Range

        protected adams.core.Range m_Range
    • Constructor Detail

      • AbstainAttributePercentile

        public AbstainAttributePercentile()
    • 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 interface weka.core.OptionHandler
        Overrides:
        listOptions in class weka.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 interface weka.core.OptionHandler
        Overrides:
        setOptions in class weka.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 interface weka.core.OptionHandler
        Overrides:
        getOptions in class weka.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 interface weka.core.CapabilitiesHandler
        Specified by:
        getCapabilities in interface weka.classifiers.Classifier
        Overrides:
        getCapabilities in class weka.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 interface weka.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 interface weka.classifiers.Classifier
        Overrides:
        classifyInstance in class weka.classifiers.AbstractClassifier
        Throws:
        Exception
      • canAbstain

        public boolean canAbstain()
        Whether abstaining is possible, e.g., used in meta-classifiers.
        Specified by:
        canAbstain in interface AbstainingClassifier
        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 interface AbstainingClassifier
        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 interface AbstainingClassifier
        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.
        Overrides:
        toString in class Object
      • getRevision

        public String getRevision()
        Specified by:
        getRevision in interface weka.core.RevisionHandler
        Overrides:
        getRevision in class weka.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