程序包 weka.core

类 AttributeExpression

java.lang.Object
weka.core.AttributeExpression
所有已实现的接口:
Serializable, RevisionHandler

public class AttributeExpression extends Object implements 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
另请参阅:
  • 构造器详细资料

    • AttributeExpression

      public AttributeExpression()
  • 方法详细资料

    • convertInfixToPostfix

      public void convertInfixToPostfix(String infixExp) throws Exception
      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

      public double evaluateExpression(Instance instance) throws Exception
      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

      public void evaluateExpression(double[] vals) throws Exception
      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

      public String getPostFixExpression()
      Return the postfix expression
      返回:
      the postfix expression as a String
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object
    • getRevision

      public String getRevision()
      Returns the revision string.
      指定者:
      getRevision 在接口中 RevisionHandler
      返回:
      the revision