|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.filters.Filter
weka.filters.unsupervised.attribute.AddExpression
public class AddExpression
An instance filter that creates a new attribute by applying a mathematical expression to existing attributes. The expression can contain attribute references and numeric constants. 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).
Example expression : a1^2*a5/log(a7*4.0).
-E <expression> Specify the expression to apply. Eg a1^2*a5/log(a7*4.0). Supported opperators: ,+, -, *, /, ^, log, abs, cos, exp, sqrt, floor, ceil, rint, tan, sin, (, ) (default: a1^2)
-N <name> Specify the name for the new attribute. (default is the expression provided with -E)
-D Debug. Names attribute with the postfix parse of the expression.
Constructor Summary | |
---|---|
AddExpression()
|
Method Summary | |
---|---|
java.lang.String |
debugTipText()
Returns the tip text for this property |
java.lang.String |
expressionTipText()
Returns the tip text for this property |
Capabilities |
getCapabilities()
Returns the Capabilities of this filter. |
boolean |
getDebug()
Gets whether debug is set |
java.lang.String |
getExpression()
Get the expression |
java.lang.String |
getName()
Returns the name of the new attribute |
java.lang.String[] |
getOptions()
Gets the current settings of the filter. |
java.lang.String |
getRevision()
Returns the revision string. |
java.lang.String |
globalInfo()
Returns a string describing this filter |
boolean |
input(Instance instance)
Input an instance for filtering. |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options. |
static void |
main(java.lang.String[] args)
Main method for testing this class. |
java.lang.String |
nameTipText()
Returns the tip text for this property |
void |
setDebug(boolean d)
Set debug mode. |
void |
setExpression(java.lang.String expr)
Set the expression to apply |
boolean |
setInputFormat(Instances instanceInfo)
Sets the format of the input instances. |
void |
setName(java.lang.String name)
Set the name for the new attribute. |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
Methods inherited from class weka.filters.Filter |
---|
batchFilterFile, batchFinished, filterFile, getCapabilities, getOutputFormat, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, numPendingOutput, output, outputPeek, toString, useFilter, wekaStaticWrapper |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AddExpression()
Method Detail |
---|
public java.lang.String globalInfo()
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-E <expression> Specify the expression to apply. Eg a1^2*a5/log(a7*4.0). Supported opperators: ,+, -, *, /, ^, log, abs, cos, exp, sqrt, floor, ceil, rint, tan, sin, (, ) (default: a1^2)
-N <name> Specify the name for the new attribute. (default is the expression provided with -E)
-D Debug. Names attribute with the postfix parse of the expression.
setOptions
in interface OptionHandler
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
public java.lang.String nameTipText()
public void setName(java.lang.String name)
name
- the name of the new attributepublic java.lang.String getName()
public java.lang.String debugTipText()
public void setDebug(boolean d)
d
- true if debug mode is to be usedpublic boolean getDebug()
public java.lang.String expressionTipText()
public void setExpression(java.lang.String expr)
expr
- a mathematical expression to applypublic java.lang.String getExpression()
public Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class Filter
Capabilities
public boolean setInputFormat(Instances instanceInfo) throws java.lang.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).
java.lang.Exception
- if the format couldn't be set successfullypublic boolean input(Instance instance) throws java.lang.Exception
input
in class Filter
instance
- the input instance
java.lang.IllegalStateException
- if no input format has been defined.
java.lang.Exception
- if there was a problem during the filtering.public java.lang.String getRevision()
getRevision
in interface RevisionHandler
public static void main(java.lang.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 |