public class PartitionedMultiFilter extends SimpleBatchFilter
-D Turns on output of debugging information.
-F <classname [options]> A filter to apply (can be specified multiple times).
-R <range> An attribute range (can be specified multiple times). For each filter a range must be supplied. 'first' and 'last' are valid indices. 'inv(...)' around the range denotes an inverted range.
-U Flag for leaving unused attributes out of the output, by default these are included in the filter output.
StreamableFilter
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected Filter[] |
m_Filters
The filters.
|
protected int[] |
m_IndicesUnused
the indices of the unused attributes.
|
protected Range[] |
m_Ranges
The attribute ranges.
|
protected boolean |
m_RemoveUnused
Whether unused attributes are left out of the output.
|
m_Debug
m_FirstBatchDone, m_InputRelAtts, m_InputStringAtts, m_NewBatch, m_OutputRelAtts, m_OutputStringAtts
Constructor and Description |
---|
PartitionedMultiFilter() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkDimensions()
checks whether the dimensions of filters and ranges fit together.
|
protected Instances |
determineOutputFormat(Instances inputFormat)
Determines the output format based only on the full input dataset and
returns this otherwise null is returned.
|
protected void |
determineUnusedIndices(Instances data)
determines the indices of unused attributes (ones that are not covered
by any of the range).
|
String |
filtersTipText()
Returns the tip text for this property.
|
protected Instances |
generateSubset(Instances data,
Range range)
generates a subset of the dataset with only the attributes from the range
(class is always added if present).
|
Filter |
getFilter(int index)
Gets a single filter from the set of available filters.
|
Filter[] |
getFilters()
Gets the list of possible filters to choose from.
|
protected String |
getFilterSpec(Filter filter)
returns the filter classname and the options as one string.
|
String[] |
getOptions()
Gets the current settings of the filter.
|
Range |
getRange(int index)
Gets a single Range from the set of available Ranges.
|
Range[] |
getRanges()
Gets the list of possible Ranges to choose from.
|
boolean |
getRemoveUnused()
Gets whether unused attributes (ones that are not covered by any of the
ranges) are removed from the output.
|
String |
getRevision()
Returns the revision string.
|
String |
globalInfo()
Returns a string describing this filter.
|
Enumeration |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(String[] args)
Main method for executing this class.
|
protected Instances |
process(Instances instances)
Processes the given data (may change the provided dataset) and returns
the modified version.
|
String |
rangesTipText()
Returns the tip text for this property.
|
String |
removeUnusedTipText()
Returns the tip text for this property.
|
protected Instances |
renameAttributes(Instances data,
String prefix)
renames all the attributes in the dataset (excluding the class if present)
by adding the prefix to the name.
|
void |
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 |
setRanges(Range[] Ranges)
Sets the list of possible Ranges to choose from.
|
void |
setRemoveUnused(boolean value)
Sets whether unused attributes (ones that are not covered by any of the
ranges) are removed from the output.
|
protected void |
testInputFormat(Instances instanceInfo)
tests the data whether the filter can actually handle it.
|
batchFinished, hasImmediateOutputFormat, input
debugTipText, getDebug, reset, setDebug, setInputFormat
batchFilterFile, bufferInput, copyValues, copyValues, filterFile, flushInput, getCapabilities, getCapabilities, getInputFormat, getOutputFormat, initInputLocators, initOutputLocators, inputFormatPeek, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, numPendingOutput, output, outputFormatPeek, outputPeek, push, resetQueue, runFilter, setOutputFormat, toString, useFilter, wekaStaticWrapper
protected Filter[] m_Filters
protected Range[] m_Ranges
protected boolean m_RemoveUnused
protected int[] m_IndicesUnused
public String globalInfo()
globalInfo
in class SimpleFilter
public Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class SimpleFilter
public void setOptions(String[] options) throws Exception
-D Turns on output of debugging information.
-F <classname [options]> A filter to apply (can be specified multiple times).
-R <range> An attribute range (can be specified multiple times). For each filter a range must be supplied. 'first' and 'last' are valid indices. 'inv(...)' around the range denotes an inverted range.
-U Flag for leaving unused attributes out of the output, by default these are included in the filter output.
setOptions
in interface OptionHandler
setOptions
in class SimpleFilter
options
- the list of options as an array of stringsException
- if an option is not supportedSimpleFilter.reset()
public String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class SimpleFilter
protected void checkDimensions() throws Exception
Exception
- if dimensions differprotected void testInputFormat(Instances instanceInfo) throws Exception
testInputFormat
in class Filter
instanceInfo
- the data to testException
- if the test failspublic void setRemoveUnused(boolean value)
value
- if true then the unused attributes get removedpublic boolean getRemoveUnused()
public String removeUnusedTipText()
public void setFilters(Filter[] filters)
filters
- an array of filters with all options set.SimpleFilter.reset()
public Filter[] getFilters()
public String filtersTipText()
public Filter getFilter(int index)
index
- the index of the filter wantedprotected String getFilterSpec(Filter filter)
filter
- the filter to get the specs forpublic void setRanges(Range[] Ranges)
Ranges
- an array of Ranges with all options set.SimpleFilter.reset()
public Range[] getRanges()
public String rangesTipText()
public Range getRange(int index)
index
- the index of the Range wantedprotected void determineUnusedIndices(Instances data)
data
- the data to base the determination onm_IndicesUnused
protected Instances generateSubset(Instances data, Range range) throws Exception
data
- the data to work onrange
- the range of attribute to useException
- if creation failsprotected Instances renameAttributes(Instances data, String prefix) throws Exception
data
- the data to work onprefix
- the prefix for the attributesException
- if renaming failsprotected Instances determineOutputFormat(Instances inputFormat) throws Exception
determineOutputFormat
in class SimpleFilter
inputFormat
- the input format to base the output format onException
- in case the determination goes wrongSimpleBatchFilter.hasImmediateOutputFormat()
,
SimpleBatchFilter.batchFinished()
protected Instances process(Instances instances) throws Exception
process
in class SimpleFilter
instances
- the data to processException
- in case the processing goes wrongSimpleBatchFilter.batchFinished()
public String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class Filter
public static void main(String[] args)
args
- should contain arguments for the filter: use -h for helpCopyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.