程序包 weka.core
类 AttributeExpression
java.lang.Object
weka.core.AttributeExpression
- 所有已实现的接口:
Serializable
,RevisionHandler
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, (, ).
- 版本:
- $Revision: 5989 $
- 作者:
- Mark Hall
- 另请参阅:
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明void
convertInfixToPostfix
(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.Return the postfix expressionReturns the revision string.toString()
-
构造器详细资料
-
AttributeExpression
public AttributeExpression()
-
-
方法详细资料
-
convertInfixToPostfix
Converts a string containing a mathematical expression in infix form to postfix form. The result is stored in the vector m_postfixExpVector- 参数:
infixExp
- the infix expression to convert- 抛出:
Exception
- if something goes wrong during the conversion
-
evaluateExpression
Evaluate the expression using the supplied Instance. Assumes that the infix expression has been converted to postfix and stored in m_postFixExpVector- 参数:
instance
- the Instance containing values to apply the expression to- 抛出:
Exception
- if something goes wrong
-
evaluateExpression
Evaluate the expression using the supplied array of attribute values. The result is stored in the last element of the array. Assumes that the infix expression has been converted to postfix and stored in m_postFixExpVector- 参数:
vals
- the values to apply the expression to- 抛出:
Exception
- if something goes wrong
-
getPostFixExpression
Return the postfix expression- 返回:
- the postfix expression as a String
-
toString
-
getRevision
Returns the revision string.- 指定者:
getRevision
在接口中RevisionHandler
- 返回:
- the revision
-