public class MathExpression extends PotentialClassIgnorer implements UnsupervisedFilter
-unset-class-temporarily Unsets the class index temporarily before the filter is applied to the data. (default: no)
-E <expression> Specify the expression to apply. Eg. pow(A,6)/(MEAN+MAX) Supported operators are +, -, *, /, pow, log, abs, cos, exp, sqrt, tan, sin, ceil, floor, rint, (, ), MEAN, MAX, MIN, SD, COUNT, SUM, SUMSQUARED, ifelse
-R <index1,index2-index4,...> Specify list of columns to ignore. First and last are valid indexes. (default none)
-V Invert matching sense (i.e. only modify specified columns)
MathematicalExpression
,
Serialized FormModifier and Type | Field and Description |
---|---|
static String |
m_defaultExpression
The default modification expression
|
protected Range |
m_SelectCols
Stores which columns to select as a funky range
|
m_ClassIndex, m_IgnoreClass
m_FirstBatchDone, m_InputRelAtts, m_InputStringAtts, m_NewBatch, m_OutputRelAtts, m_OutputStringAtts
Constructor and Description |
---|
MathExpression()
Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
batchFinished()
Signify that this batch of input to the filter is finished.
|
protected double |
eval(HashMap symbols)
Evaluates the symbols.
|
String |
expressionTipText()
Returns the tip text for this property
|
Capabilities |
getCapabilities()
Returns the Capabilities of this filter.
|
String |
getExpression()
Get the expression
|
String |
getIgnoreRange()
Get the current range selection.
|
boolean |
getInvertSelection()
Get whether the supplied columns are to be select or unselect
|
String[] |
getOptions()
Gets the current settings of the filter.
|
String |
getRevision()
Returns the revision string.
|
String |
globalInfo()
Returns a string describing this filter
|
String |
ignoreRangeTipText()
Returns the tip text for this property
|
boolean |
input(Instance instance)
Input an instance for filtering.
|
String |
invertSelectionTipText()
Returns the tip text for this property
|
Enumeration |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(String[] argv)
Main method for testing this class.
|
void |
setExpression(String expr)
Set the expression to apply
|
void |
setIgnoreRange(String rangeList)
Set which attributes are to be ignored
|
boolean |
setInputFormat(Instances instanceInfo)
Sets the format of the input instances.
|
void |
setInvertSelection(boolean invert)
Set whether selected columns should be select or unselect.
|
void |
setOptions(String[] options)
Parses a given list of options.
|
getIgnoreClass, getOutputFormat, ignoreClassTipText, setIgnoreClass
batchFilterFile, bufferInput, copyValues, copyValues, filterFile, flushInput, getCapabilities, getInputFormat, initInputLocators, initOutputLocators, inputFormatPeek, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, numPendingOutput, output, outputFormatPeek, outputPeek, push, resetQueue, runFilter, setOutputFormat, testInputFormat, toString, useFilter, wekaStaticWrapper
protected Range m_SelectCols
public static final String m_defaultExpression
public String globalInfo()
public Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class Filter
Capabilities
public boolean setInputFormat(Instances instanceInfo) throws Exception
setInputFormat
in class PotentialClassIgnorer
instanceInfo
- an Instances object containing the input
instance structure (any instances contained in the object are
ignored - only the structure is required).Exception
- if the input format can't be set
successfullypublic boolean input(Instance instance) throws Exception
input
in class Filter
instance
- the input instanceIllegalStateException
- if no input format has been set.NullPointerException
- if the input format has not been
defined.Exception
- if the input instance was not of the correct
format or if there was a problem with the filtering.public boolean batchFinished() throws Exception
batchFinished
in class Filter
IllegalStateException
- if no input structure has been definedNullPointerException
- if no input structure has been defined,Exception
- if there was a problem finishing the batch.protected double eval(HashMap symbols)
symbols
- the symbols to use for evaluationpublic void setOptions(String[] options) throws Exception
-unset-class-temporarily Unsets the class index temporarily before the filter is applied to the data. (default: no)
-E <expression> Specify the expression to apply. Eg. pow(A,6)/(MEAN+MAX) Supported operators are +, -, *, /, pow, log, abs, cos, exp, sqrt, tan, sin, ceil, floor, rint, (, ), MEAN, MAX, MIN, SD, COUNT, SUM, SUMSQUARED, ifelse
-R <index1,index2-index4,...> Specify list of columns to ignore. First and last are valid indexes. (default none)
-V Invert matching sense (i.e. only modify specified columns)
setOptions
in interface OptionHandler
setOptions
in class PotentialClassIgnorer
options
- the list of options as an array of stringsException
- if an option is not supportedpublic String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class PotentialClassIgnorer
public Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class PotentialClassIgnorer
public String expressionTipText()
public void setExpression(String expr)
expr
- a mathematical expression to applypublic String getExpression()
public String invertSelectionTipText()
public boolean getInvertSelection()
public void setInvertSelection(boolean invert)
invert
- the new invert settingpublic String ignoreRangeTipText()
public String getIgnoreRange()
public void setIgnoreRange(String rangeList)
rangeList
- a string representing the list of attributes. Since
the string will typically come from a user, attributes are indexed from
1. public String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class Filter
public static void main(String[] argv)
argv
- should contain arguments to the filter:
use -h for helpCopyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.