weka.filters.unsupervised.attribute
Class PotentialClassIgnorer

java.lang.Object
  extended byweka.filters.Filter
      extended byweka.filters.unsupervised.attribute.PotentialClassIgnorer
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Discretize, Normalize, NumericToBinary, ReplaceMissingValues, Standardize

public abstract class PotentialClassIgnorer
extends Filter

This filter should be extended by other unsupervised attribute filters to allow processing of the class attribute if that's required. It the class is to be ignored it is essential that the extending filter does not change the position (i.e. index) of the attribute that is originally the class attribute !

Version:
$Revision: 1.2 $
Author:
Eibe Frank (eibe@cs.waikato.ac.nz), Mark Hall (mhall@cs.waikato.ac.nz)
See Also:
Serialized Form

Field Summary
protected  int m_ClassIndex
          Storing the class index
protected  boolean m_IgnoreClass
          True if the class is to be unset
 
Fields inherited from class weka.filters.Filter
m_NewBatch
 
Constructor Summary
PotentialClassIgnorer()
           
 
Method Summary
 Instances getOutputFormat()
          Gets the format of the output instances.
 void setIgnoreClass(boolean newIgnoreClass)
          Set the IgnoreClass value.
 boolean setInputFormat(Instances instanceInfo)
          Sets the format of the input instances.
 
Methods inherited from class weka.filters.Filter
batchFilterFile, batchFinished, bufferInput, copyStringValues, copyStringValues, filterFile, flushInput, getInputFormat, getInputStringIndex, getOutputStringIndex, getStringIndices, input, inputFormat, inputFormatPeek, isOutputFormatDefined, main, numPendingOutput, output, outputFormat, outputFormatPeek, outputPeek, push, resetQueue, setOutputFormat, useFilter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_IgnoreClass

protected boolean m_IgnoreClass
True if the class is to be unset


m_ClassIndex

protected int m_ClassIndex
Storing the class index

Constructor Detail

PotentialClassIgnorer

public PotentialClassIgnorer()
Method Detail

setInputFormat

public boolean setInputFormat(Instances instanceInfo)
                       throws java.lang.Exception
Sets the format of the input instances. If the filter is able to determine the output format before seeing any input instances, it does so here. This default implementation clears the output format and output queue, and the new batch flag is set. Overriders should call super.setInputFormat(Instances)

Overrides:
setInputFormat in class Filter
Parameters:
instanceInfo - an Instances object containing the input instance structure (any instances contained in the object are ignored - only the structure is required).
Returns:
true if the outputFormat may be collected immediately
Throws:
java.lang.Exception - if the inputFormat can't be set successfully

getOutputFormat

public final Instances getOutputFormat()
Gets the format of the output instances. This should only be called after input() or batchFinished() has returned true. The relation name of the output instances should be changed to reflect the action of the filter (eg: add the filter name and options).

Overrides:
getOutputFormat in class Filter
Returns:
an Instances object containing the output instance structure only.
Throws:
java.lang.NullPointerException - if no input structure has been defined (or the output format hasn't been determined yet)

setIgnoreClass

public void setIgnoreClass(boolean newIgnoreClass)
Set the IgnoreClass value. Set this to true if the class index is to be unset before the filter is applied.

Parameters:
newIgnoreClass - The new IgnoreClass value.