Class RangeCheck

  • All Implemented Interfaces:
    Serializable, Cloneable, weka.classifiers.Classifier, RangeCheckClassifier, weka.core.BatchPredictor, weka.core.CapabilitiesHandler, weka.core.CapabilitiesIgnorer, weka.core.CommandlineRunnable, weka.core.OptionHandler, weka.core.RevisionHandler

    public class RangeCheck
    extends weka.classifiers.SingleClassifierEnhancer
    implements RangeCheckClassifier
    Keeps track of the ranges in case of numeric attributes. It then allows checks whether an instance is for one or more attributes outside the training range.

    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
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected weka.core.Instances m_Header
      the training header.
      protected Hashtable<Integer,​double[]> m_Ranges
      the ranges (attribute index <-> double[]).
      • 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
    • Constructor Summary

      Constructors 
      Constructor Description
      RangeCheck()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void buildClassifier​(weka.core.Instances data)
      Build the classifier on the filtered data.
      List<String> checkRangeForInstance​(weka.core.Instance inst)
      Checks the range for the instance.
      double[] distributionForInstance​(weka.core.Instance instance)
      Classifies a given instance after filtering.
      String globalInfo()
      Returns a string describing this classifier.
      String toString()
      Output a representation of this classifier
      • Methods inherited from class weka.classifiers.SingleClassifierEnhancer

        classifierTipText, defaultClassifierOptions, defaultClassifierString, getCapabilities, getClassifier, getClassifierSpec, getOptions, listOptions, postExecution, preExecution, setClassifier, setOptions
      • Methods inherited from class weka.classifiers.AbstractClassifier

        batchSizeTipText, classifyInstance, debugTipText, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, getRevision, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
      • Methods inherited from interface weka.classifiers.Classifier

        classifyInstance, getCapabilities
    • Field Detail

      • m_Ranges

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

        protected weka.core.Instances m_Header
        the training header.
    • Constructor Detail

      • RangeCheck

        public RangeCheck()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing this classifier.
        Returns:
        a description of the classifier suitable for displaying in the explorer/experimenter gui
      • buildClassifier

        public void buildClassifier​(weka.core.Instances data)
                             throws Exception
        Build the classifier on the filtered data.
        Specified by:
        buildClassifier in interface weka.classifiers.Classifier
        Parameters:
        data - the training data
        Throws:
        Exception - if the classifier could not be built successfully
      • distributionForInstance

        public double[] distributionForInstance​(weka.core.Instance instance)
                                         throws Exception
        Classifies a given instance after filtering.
        Specified by:
        distributionForInstance in interface weka.classifiers.Classifier
        Overrides:
        distributionForInstance in class weka.classifiers.AbstractClassifier
        Parameters:
        instance - the instance to be classified
        Returns:
        the class distribution for the given instance
        Throws:
        Exception - if instance could not be classified successfully
      • checkRangeForInstance

        public List<String> checkRangeForInstance​(weka.core.Instance inst)
        Checks the range for the instance. The array contains an entry for each attribute that exceeded the stored ranges.
        Specified by:
        checkRangeForInstance in interface RangeCheckClassifier
        Parameters:
        inst - the instance to check
        Returns:
        the failed checks
      • toString

        public String toString()
        Output a representation of this classifier
        Overrides:
        toString in class Object
        Returns:
        a representation of this classifier