weka.filters
Class AttributeTypeFilter

java.lang.Object
  |
  +--weka.filters.Filter
        |
        +--weka.filters.AttributeTypeFilter
All Implemented Interfaces:
OptionHandler, Serializable

public class AttributeTypeFilter
extends Filter
implements OptionHandler

An instance filter that deletes all attributes of a specified type from the dataset.

Valid filter-specific options are:

-T type
Specify the attribute type to delete. Valid values are "nominal", "numeric", and "string". (default "string")

Version:
$Revision: 1.9 $
Author:
Len Trigg (len@intelligenesis.net)
See Also:
Serialized Form

Field Summary
protected  int m_DeleteType
          Stores which type of attribute to delete
static Tag[] TAGS_ATTRIBUTES
           
 
Fields inherited from class weka.filters.Filter
m_Debug, m_NewBatch
 
Constructor Summary
AttributeTypeFilter()
           
 
Method Summary
 SelectedTag getAttributeType()
          Gets the type of attribute that will be deleted.
 String[] getOptions()
          Gets the current settings of the filter.
 boolean input(Instance instance)
          Input an instance for filtering.
 Enumeration listOptions()
          Returns an enumeration describing the available options
static void main(String[] argv)
          Main method for testing this class.
 void setAttributeType(SelectedTag newType)
          Sets the type of attribute to delete.
 boolean setInputFormat(Instances instanceInfo)
          Sets the format of the input instances.
 void setOptions(String[] options)
          Parses a given list of options controlling the behaviour of this object.
 
Methods inherited from class weka.filters.Filter
batchFilterFile, batchFinished, bufferInput, copyStringValues, copyStringValues, filterFile, flushInput, getInputFormat, getInputStringIndex, getOutputFormat, getOutputStringIndex, getStringIndices, inputFormat, isOutputFormatDefined, 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_DeleteType

protected int m_DeleteType
Stores which type of attribute to delete


TAGS_ATTRIBUTES

public static final Tag[] TAGS_ATTRIBUTES
Constructor Detail

AttributeTypeFilter

public AttributeTypeFilter()
Method Detail

listOptions

public Enumeration listOptions()
Returns an enumeration describing the available options

Specified by:
listOptions in interface OptionHandler
Returns:
an enumeration of all the available options

setOptions

public void setOptions(String[] options)
                throws Exception
Parses a given list of options controlling the behaviour of this object. Valid options are:

-T type
Specify the attribute type to delete. Valid values are "nominal", "numeric", and "string". (default "string")

Specified by:
setOptions in interface OptionHandler
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 settings of the filter.

Specified by:
getOptions in interface OptionHandler
Returns:
an array of strings suitable for passing to setOptions

getAttributeType

public SelectedTag getAttributeType()
Gets the type of attribute that will be deleted. The ID will be one of Attribute.STRING, Attribute.NOMINAL, or Attribute.NUMERIC.

Returns:
the selected attribute type.

setAttributeType

public void setAttributeType(SelectedTag newType)
Sets the type of attribute to delete. Values other than Attribute.STRING, Attribute.NOMINAL, or Attribute.NUMERIC will be ignored.


setInputFormat

public boolean setInputFormat(Instances instanceInfo)
                       throws Exception
Sets the format of the input 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:
Exception - if the format couldn't be set successfully

input

public boolean input(Instance instance)
Input an instance for filtering. Ordinarily the instance is processed and made available for output immediately. Some filters require all instances be read before producing output.

Overrides:
input in class Filter
Parameters:
instance - the input instance
Returns:
true if the filtered instance may now be collected with output().
Throws:
IllegalStateException - if no input format has been defined.

main

public static void main(String[] argv)
Main method for testing this class.

Parameters:
argv - should contain arguments to the filter: use -h for help