Package weka.filters
Class MultiFilter
java.lang.Object
weka.filters.Filter
weka.filters.SimpleFilter
weka.filters.SimpleStreamFilter
weka.filters.MultiFilter
- All Implemented Interfaces:
Serializable
,CapabilitiesHandler
,CapabilitiesIgnorer
,CommandlineRunnable
,OptionHandler
,Randomizable
,RevisionHandler
,WeightedAttributesHandler
,WeightedInstancesHandler
,StreamableFilter
public class MultiFilter
extends SimpleStreamFilter
implements WeightedAttributesHandler, WeightedInstancesHandler, Randomizable
Applies several filters successively. In case all
supplied filters are StreamableFilters, it will act as a streamable one, too.
Valid options are:
-D Turns on output of debugging information.
-F <classname [options]> A filter to apply (can be specified multiple times).
-S num
The random number seed that will be passed through all filters that are randomizable (default 1).
- Version:
- $Revision: 15791 $
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Signify that this batch of input to the filter is finished.Returns the tip text for this propertyReturns the Capabilities of this filter.getFilter
(int index) Gets a single filter from the set of available filters.Filter[]
Gets the list of possible filters to choose from.String[]
Gets the current settings of the filter.Returns the revision string.int
getSeed()
Gets the seed for the random number generationsReturns a string describing this filterboolean
tests whether all the enclosed filters are streamableReturns an enumeration describing the available options.static void
Main method for executing this class.boolean
RemoveWithValues may return false from input() (thus not making an instance available immediately) even after the first batch has been completed due to matching a value that the user wants to remove.Returns the tip text for this propertyvoid
setFilters
(Filter[] filters) Sets the list of possible filters to choose from.void
setOptions
(String[] options) Parses a list of options for this object.void
setSeed
(int seed) Set the seed for random number generation.Methods inherited from class weka.filters.SimpleStreamFilter
input
Methods inherited from class weka.filters.SimpleFilter
setInputFormat
Methods inherited from class weka.filters.Filter
batchFilterFile, debugTipText, doNotCheckCapabilitiesTipText, filterFile, getCapabilities, getCopyOfInputFormat, getDebug, getDoNotCheckCapabilities, getOutputFormat, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, numPendingOutput, output, outputPeek, postExecution, preExecution, run, runFilter, setDebug, setDoNotCheckCapabilities, toString, useFilter, wekaStaticWrapper
-
Constructor Details
-
MultiFilter
public MultiFilter()
-
-
Method Details
-
globalInfo
Returns a string describing this filter- Specified by:
globalInfo
in classSimpleFilter
- Returns:
- a description of the filter suitable for displaying in the explorer/experimenter gui
-
listOptions
Returns an enumeration describing the available options.- Specified by:
listOptions
in interfaceOptionHandler
- Overrides:
listOptions
in classFilter
- Returns:
- an enumeration of all the available options.
-
setOptions
Parses a list of options for this object. Valid options are:-D Turns on output of debugging information.
-S num
The random number seed that will be passed through all filters that are randomizable (default 1).-F <classname [options]> A filter to apply (can be specified multiple times).
- Specified by:
setOptions
in interfaceOptionHandler
- Overrides:
setOptions
in classFilter
- Parameters:
options
- the list of options as an array of strings- Throws:
Exception
- if an option is not supported
-
getOptions
Gets the current settings of the filter.- Specified by:
getOptions
in interfaceOptionHandler
- Overrides:
getOptions
in classFilter
- Returns:
- an array of strings suitable for passing to setOptions
-
getCapabilities
Returns the Capabilities of this filter.- Specified by:
getCapabilities
in interfaceCapabilitiesHandler
- Overrides:
getCapabilities
in classFilter
- Returns:
- the capabilities of this object
- See Also:
-
setFilters
Sets the list of possible filters to choose from. Also resets the state of the filter (this reset doesn't affect the options).- Parameters:
filters
- an array of filters with all options set.- See Also:
-
reset()
-
getFilters
Gets the list of possible filters to choose from.- Returns:
- the array of Filters
-
filtersTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getFilter
Gets a single filter from the set of available filters.- Parameters:
index
- the index of the filter wanted- Returns:
- the Filter
-
seedTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setSeed
public void setSeed(int seed) Set the seed for random number generation.- Specified by:
setSeed
in interfaceRandomizable
- Parameters:
seed
- the seed
-
getSeed
public int getSeed()Gets the seed for the random number generations- Specified by:
getSeed
in interfaceRandomizable
- Returns:
- the seed for the random number generation
-
isStreamableFilter
public boolean isStreamableFilter()tests whether all the enclosed filters are streamable- Returns:
- true if all the enclosed filters are streamable
-
batchFinished
Signify that this batch of input to the filter is finished. If the filter requires all instances prior to filtering, output() may now be called to retrieve the filtered instances. Any subsequent instances filtered should be filtered based on setting obtained from the first batch (unless the setInputFormat has been re-assigned or new options have been set).- Overrides:
batchFinished
in classSimpleStreamFilter
- Returns:
- true if there are instances pending output
- Throws:
IllegalStateException
- if no input format has been set.NullPointerException
- if no input structure has been defined,Exception
- if there was a problem finishing the batch.
-
mayRemoveInstanceAfterFirstBatchDone
public boolean mayRemoveInstanceAfterFirstBatchDone()RemoveWithValues may return false from input() (thus not making an instance available immediately) even after the first batch has been completed due to matching a value that the user wants to remove. Therefore this method returns true.- Overrides:
mayRemoveInstanceAfterFirstBatchDone
in classFilter
- Returns:
- true if one of the base filters returns true for this method.
-
getRevision
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Overrides:
getRevision
in classFilter
- Returns:
- the revision
-
main
Main method for executing this class.- Parameters:
args
- should contain arguments for the filter: use -h for help
-