org.debellor.weka
Class WekaFilter

java.lang.Object
  extended by org.debellor.core.Cell
      extended by org.debellor.weka.WekaFilter

public class WekaFilter
extends Cell

Debellor wrapper for Weka filters - subclasses of weka.filters.Filter. Weka class implementing the filter is identified by its name given in long (with package specification) or short form. This name must exactly match (including case) the corresponding Weka class name. Available names can be found by running Weka GUI (Explorer or Experimenter) and opening the selection list of filters. Alternatively, you can browse Weka code (subpackages of weka.filters package).

Parameters (or options in Weka's terminology) can be passed to the Weka filter in a standard Debellor's way, by calling Cell.set(java.lang.String, java.lang.String) or Cell.setParameters(org.debellor.core.Parameters). Parameters should have names of corresponding Weka options, exactly in the same form as is printed in Weka GUI in the dialog for setting filter options.

Filter is applied to Weka Instances created by concatenation of data and decision fields of input samples (if both are present, as indicated by Sample.SampleType; otherwise only one of the fields is used). Decision is placed as the last attribute of the instances and marked as class attribute.

After filtering, if output instances have class attribute specified, this attribute is extracted as a sample decision.

All input data are first buffered and then passed together to the filter. Thus, filters do not work in on-line fashion.

Author:
Marcin Wojnarski
See Also:
WekaClassifier

Nested Class Summary
 
Nested classes/interfaces inherited from class org.debellor.core.Cell
Cell.CellMethod, Cell.State, Cell.Stream
 
Field Summary
protected  Cell.Stream input
           
 
Fields inherited from class org.debellor.core.Cell
parameters, random
 
Constructor Summary
WekaFilter(java.lang.String className)
           
 
Method Summary
protected  void onClose()
          Called by Cell.Stream.close().
protected  Sample onNext()
          Called by Cell.Stream.next().
protected  Sample.SampleType onOpen()
          Called by Cell.open().
 
Methods inherited from class org.debellor.core.Cell
close, erase, getAvailableParams, getParameters, learn, newThread, newThread, next, onErase, onLearn, open, openInputStream, set, set, set, set, setAvailableParams, setParameters, setRandomSeed, setSource, state, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

input

protected Cell.Stream input
Constructor Detail

WekaFilter

public WekaFilter(java.lang.String className)
           throws AmbiguousClassNameException
Parameters:
className - Name of Weka class implementing the filter algorithm, given in long (with package specification) or short form.
Throws:
AmbiguousClassNameException
Method Detail

onOpen

protected Sample.SampleType onOpen()
                            throws java.lang.Exception
Description copied from class: Cell
Called by Cell.open(). Performs the actual opening of communication session, while open checks only against access violation and handles exceptions. Must be overridden in subclasses if open is to be used. Overriders may assume that the cell is in Cell.State.CLOSED state.

Overrides:
onOpen in class Cell
Throws:
java.lang.Exception

onNext

protected Sample onNext()
                 throws java.lang.Exception
Description copied from class: Cell
Called by Cell.Stream.next(). Performs the actual generation of the next output sample, while Stream.next() checks only against access violation and handles exceptions. Must be overridden in the subclass if next is to be used, i.e. if the subclass should generate some output data. Overriders may assume that the cell is in Cell.State.OPEN state.

Overrides:
onNext in class Cell
Throws:
java.lang.Exception

onClose

protected void onClose()
                throws java.lang.Exception
Description copied from class: Cell
Called by Cell.Stream.close(). Performs the actual closing of communication session, while close checks only against access violation and handles exceptions. Must be overridden in subclasses if close is to be used. Usually the overrider will use onClose to release resources, to let them be garbage-collected. Overriders may assume that the cell is in Cell.State.OPEN state.

Overrides:
onClose in class Cell
Throws:
java.lang.Exception