wpi.filters
Class TimeSequenceInstanceFilter

java.lang.Object
  extended byweka.filters.Filter
      extended bywpi.filters.TimeSequenceInstanceFilter
All Implemented Interfaces:
weka.core.OptionHandler, java.io.Serializable

public class TimeSequenceInstanceFilter
extends weka.filters.Filter
implements weka.core.OptionHandler

Assumes intances form a single instance containing time sequence attributes. Each instance in instances comprises a point in time. The values for each instance corresponding to a single point in time are concatanated to form a single value for each attribute using a delimeter ":" to seperate each value inside a time sequence attribute. A time_number attribute is added for relative reference to points in time.
Please note: if the delimeter appears in the values of the data being filtered it will be replaced by a "-" Valid filter-specific options are:

Version:
$Revision: 0.9 $
Author:
Keith A. Pray (kap@wpi.edu)
See Also:
Serialized Form

Field Summary
static char DELIMITER_REPLACE
          The character used to replace occurrances of the delimiter in the actual data being filtered
static java.lang.String TIMELINE
          The name of the time line attribute that this filter creates
 
Fields inherited from class weka.filters.Filter
m_NewBatch
 
Constructor Summary
TimeSequenceInstanceFilter()
           
 
Method Summary
 boolean batchFinished()
          Signifies that this batch of input to the filter is finished.
 java.lang.String[] getOptions()
          Gets the current settings of the filter.
 java.lang.String globalInfo()
          Returns a string decribing this filter.
 boolean input(weka.core.Instance instance)
          Input an instance for filtering.
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options
static void main(java.lang.String[] argv)
          Main method for testing this class.
 boolean setInputFormat(weka.core.Instances instanceInfo)
          Sets the format of the input instances.
 void setOptions(java.lang.String[] options)
          Parses a list of options for this object.
private  void setOutputFormat()
          Sets the output format.
 
Methods inherited from class weka.filters.Filter
batchFilterFile, 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

DELIMITER_REPLACE

public static char DELIMITER_REPLACE
The character used to replace occurrances of the delimiter in the actual data being filtered


TIMELINE

public static java.lang.String TIMELINE
The name of the time line attribute that this filter creates

Constructor Detail

TimeSequenceInstanceFilter

public TimeSequenceInstanceFilter()
Method Detail

setInputFormat

public boolean setInputFormat(weka.core.Instances instanceInfo)
                       throws java.lang.Exception
Sets the format of the input instances.

Parameters:
instanceInfo - an Instances object containing the input instance structure (any values of instances contained in the object are ignored) but in addition to the structure, this filter does require to know the number of instances in the input data set.
Returns:
true if the outputFormat may be collected immediately
Throws:
java.lang.Exception - if the format couldn't be set successfully

input

public boolean input(weka.core.Instance instance)
Input an instance for filtering. Filter requires all instances be read before producing output.

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

batchFinished

public boolean batchFinished()
Signifies that this batch of input to the filter is finished.

Returns:
true if there are instances pending output.
Throws:
java.lang.IllegalStateException - if no input structure has been defined.

setOutputFormat

private void setOutputFormat()
Sets the output format. Takes the buffered input instances and generates valid strings for the new attributes.


globalInfo

public java.lang.String globalInfo()
Returns a string decribing this filter.

Returns:
a description of the filter suitable for displaying in the explorer/experimenter gui

listOptions

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

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

setOptions

public void setOptions(java.lang.String[] options)
                throws java.lang.Exception
Parses a list of options for this object. Valid options are:

Specified by:
setOptions in interface weka.core.OptionHandler
Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an option is not supported

getOptions

public java.lang.String[] getOptions()
Gets the current settings of the filter.

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

main

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

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