|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weka.filters.Filter | +--weka.filters.AttributeExpressionFilter
Applys a mathematical expression involving attributes and numeric constants to a dataset. A new attribute is appended after the last attribute that contains the result of applying the expression. Supported operators are: +, -, *, /, ^, log, abs, cos, exp, sqrt, floor, ceil, rint, tan, sin, (, ). Attributes are specified by prefixing with 'a', eg. a7 is attribute number 7 (starting from 1).
Valid filter-specific options are:
-E expression
Specify the expression to apply. Eg. a1^2*a5/log(a7*4.0).
-N name
Specify a name for the new attribute. Default is to name it with the
expression provided with the -E option.
-D
Debug. Names the attribute with the postfix parse of the expression.
Field Summary |
Fields inherited from class weka.filters.Filter |
m_Debug, m_NewBatch |
Constructor Summary | |
AttributeExpressionFilter()
|
Method Summary | |
String |
debugTipText()
Returns the tip text for this property |
String |
expressionTipText()
Returns the tip text for this property |
boolean |
getDebug()
Gets whether debug is set |
String |
getExpression()
Get the expression |
String |
getName()
Returns the name of the new attribute |
String[] |
getOptions()
Gets the current settings of the filter. |
String |
globalInfo()
Returns a string describing this filter |
boolean |
input(Instance instance)
Input an instance for filtering. |
Enumeration |
listOptions()
Returns an enumeration describing the available options |
static void |
main(String[] args)
Main method for testing this class. |
String |
nameTipText()
Returns the tip text for this property |
void |
setDebug(boolean d)
Set debug mode. |
void |
setExpression(String expr)
Set the expression to apply |
boolean |
setInputFormat(Instances instanceInfo)
Sets the format of the input instances. |
void |
setName(String name)
Set the name for the new attribute. |
void |
setOptions(String[] options)
Parses a list of options for this object. |
Methods inherited from class weka.filters.Filter |
batchFilterFile, batchFinished, 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 |
Constructor Detail |
public AttributeExpressionFilter()
Method Detail |
public String globalInfo()
public Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(String[] options) throws Exception
-E expression
Specify the expression to apply. Eg. a1^2*a5/log(a7*4.0).
-N name
Specify a name for the new attribute. Default is to name it with the
expression provided with the -E option.
-D
Debug. Names the attribute with the postfix parse of the expression.
setOptions
in interface OptionHandler
options
- the list of options as an array of strings
Exception
- if an option is not supportedpublic String[] getOptions()
getOptions
in interface OptionHandler
public String nameTipText()
public void setName(String name)
name
- the name of the new attributepublic String getName()
public String debugTipText()
public void setDebug(boolean d)
d
- true if debug mode is to be usedpublic boolean getDebug()
public String expressionTipText()
public void setExpression(String expr)
expr
- a mathematical expression to applypublic String getExpression()
public boolean setInputFormat(Instances instanceInfo) throws Exception
setInputFormat
in class Filter
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 format couldn't be set successfullypublic boolean input(Instance instance) throws Exception
input
in class Filter
instance
- the input instance
IllegalStateException
- if no input format has been defined.
Exception
- if there was a problem during the filtering.public static void main(String[] args)
args
- should contain arguments to the filter: use -h for help
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |