weka.classifiers.meta
Class RangeCheck

java.lang.Object
  extended by weka.classifiers.AbstractClassifier
      extended by weka.classifiers.SingleClassifierEnhancer
          extended by weka.classifiers.meta.RangeCheck
All Implemented Interfaces:
Serializable, Cloneable, weka.classifiers.Classifier, RangeCheckClassifier, weka.core.CapabilitiesHandler, 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: 5605 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Field Summary
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
m_Debug
 
Constructor Summary
RangeCheck()
           
 
Method Summary
 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, defaultClassifierString, getCapabilities, getClassifier, getClassifierSpec, getOptions, listOptions, setClassifier, setOptions
 
Methods inherited from class weka.classifiers.AbstractClassifier
classifyInstance, debugTipText, forName, getDebug, getRevision, makeCopies, makeCopy, runClassifier, setDebug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
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


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.