|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectweka.filters.Filter
weka.filters.SimpleFilter
weka.filters.SimpleBatchFilter
weka.filters.unsupervised.instance.SubsetByExpression
public class SubsetByExpression
Filters instances according to a user-specified expression.
Grammar:
boolexpr_list ::= boolexpr_list boolexpr_part | boolexpr_part;
boolexpr_part ::= boolexpr:e {: parser.setResult(e); :} ;
boolexpr ::= BOOLEAN
| true
| false
| expr < expr
| expr <= expr
| expr > expr
| expr >= expr
| expr = expr
| ( boolexpr )
| not boolexpr
| boolexpr and boolexpr
| boolexpr or boolexpr
| ATTRIBUTE is STRING
;
expr ::= NUMBER
| ATTRIBUTE
| ( expr )
| opexpr
| funcexpr
;
opexpr ::= expr + expr
| expr - expr
| expr * expr
| expr / expr
;
funcexpr ::= abs ( expr )
| sqrt ( expr )
| log ( expr )
| exp ( expr )
| sin ( expr )
| cos ( expr )
| tan ( expr )
| rint ( expr )
| floor ( expr )
| pow ( expr for base , expr for exponent )
| ceil ( expr )
;
Notes:
- NUMBER
any integer or floating point number
(but not in scientific notation!)
- STRING
any string surrounded by single quotes;
the string may not contain a single quote though.
- ATTRIBUTE
the following placeholders are recognized for
attribute values:
- CLASS for the class value in case a class attribute is set.
- ATTxyz with xyz a number from 1 to # of attributes in the
dataset, representing the value of indexed attribute.
Examples:
- extracting only mammals and birds from the 'zoo' UCI dataset:
(CLASS is 'mammal') or (CLASS is 'bird')
- extracting only animals with at least 2 legs from the 'zoo' UCI dataset:
(ATT14 >= 2)
- extracting only instances with non-missing 'wage-increase-second-year'
from the 'labor' UCI dataset:
not ismissing(ATT3)
-E <expr> The expression to use for filtering (default: true).
-F Apply the filter to instances that arrive after the first (training) batch. The default is to not apply the filter (i.e. always return the instance)
| Constructor Summary | |
|---|---|
SubsetByExpression()
|
|
| Method Summary | |
|---|---|
java.lang.String |
expressionTipText()
Returns the tip text for this property. |
java.lang.String |
filterAfterFirstBatchTipText()
Returns the tip text for this property. |
Capabilities |
getCapabilities()
Returns the Capabilities of this filter. |
java.lang.String |
getExpression()
Returns the expression used for filtering. |
boolean |
getFilterAfterFirstBatch()
Get whether to apply the filter to instances that arrive once the first (training) batch has been seen. |
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 running this filter. |
void |
setExpression(java.lang.String value)
Sets the expression used for filtering. |
void |
setFilterAfterFirstBatch(boolean b)
Set whether to apply the filter to instances that arrive once the first (training) batch has been seen. |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
| Methods inherited from class weka.filters.SimpleBatchFilter |
|---|
batchFinished |
| Methods inherited from class weka.filters.SimpleFilter |
|---|
debugTipText, getDebug, setDebug, setInputFormat |
| Methods inherited from class weka.filters.Filter |
|---|
batchFilterFile, 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 SubsetByExpression()
| Method Detail |
|---|
public java.lang.String globalInfo()
globalInfo in class SimpleFilter
public boolean input(Instance instance)
throws java.lang.Exception
input in class SimpleBatchFilterinstance - the input instance
java.lang.IllegalStateException - if no input structure has been defined
java.lang.Exception - if something goes wrongSimpleBatchFilter.batchFinished()public java.util.Enumeration listOptions()
listOptions in interface OptionHandlerlistOptions in class SimpleFilter
public void setOptions(java.lang.String[] options)
throws java.lang.Exception
-E <expr> The expression to use for filtering (default: true).
-F Apply the filter to instances that arrive after the first (training) batch. The default is to not apply the filter (i.e. always return the instance)
setOptions in interface OptionHandlersetOptions in class SimpleFilteroptions - the list of options as an array of strings
java.lang.Exception - if an option is not supportedSimpleFilter.reset()public java.lang.String[] getOptions()
getOptions in interface OptionHandlergetOptions in class SimpleFilterpublic Capabilities getCapabilities()
getCapabilities in interface CapabilitiesHandlergetCapabilities in class FilterCapabilitiespublic void setExpression(java.lang.String value)
value - the expressionpublic java.lang.String getExpression()
public java.lang.String expressionTipText()
public void setFilterAfterFirstBatch(boolean b)
b - true if the filter should be applied to instances that
arrive after the first (training) batch has been processed.public boolean getFilterAfterFirstBatch()
public java.lang.String filterAfterFirstBatchTipText()
public java.lang.String getRevision()
getRevision in interface RevisionHandlergetRevision in class Filterpublic static void main(java.lang.String[] args)
args - arguments for the filter: use -h for help
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||