|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.core.AttributeExpression
public class AttributeExpression
A general purpose class for parsing mathematical expressions involving attribute values. Values can be provided in an array or in an Instance. Values are accessed in the expression by prefixing their index (starting at 1) with the character 'a'.
Example expression: a1^2*a5/log(a7*4.0)Supported opperators: +, -, *, /, ^, log, abs, cos, exp, sqrt, floor, ceil, rint, tan, sin, (, ).
Constructor Summary | |
---|---|
AttributeExpression()
|
Method Summary | |
---|---|
void |
convertInfixToPostfix(java.lang.String infixExp)
Converts a string containing a mathematical expression in infix form to postfix form. |
void |
evaluateExpression(double[] vals)
Evaluate the expression using the supplied array of attribute values. |
double |
evaluateExpression(Instance instance)
Evaluate the expression using the supplied Instance. |
java.lang.String |
getPostFixExpression()
Return the postfix expression |
java.lang.String |
getRevision()
Returns the revision string. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AttributeExpression()
Method Detail |
---|
public void convertInfixToPostfix(java.lang.String infixExp) throws java.lang.Exception
infixExp
- the infix expression to convert
java.lang.Exception
- if something goes wrong during the conversionpublic double evaluateExpression(Instance instance) throws java.lang.Exception
instance
- the Instance containing values to apply
the expression to
java.lang.Exception
- if something goes wrongpublic void evaluateExpression(double[] vals) throws java.lang.Exception
vals
- the values to apply the expression to
java.lang.Exception
- if something goes wrongpublic java.lang.String getPostFixExpression()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getRevision()
getRevision
in interface RevisionHandler
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |