weka.core.pmml
Class Discretize

java.lang.Object
  extended by weka.core.pmml.Expression
      extended by weka.core.pmml.Discretize
All Implemented Interfaces:
java.io.Serializable

public class Discretize
extends Expression

Class encapsulating a Discretize Expression.

Version:
$Revision 1.0 $
Author:
Mark Hall (mhall{[at]}pentaho{[dot]}com)
See Also:
Serialized Form

Constructor Summary
Discretize(org.w3c.dom.Element discretize, FieldMetaInfo.Optype opType, java.util.ArrayList<Attribute> fieldDefs)
          Constructs a Discretize Expression
 
Method Summary
 double getResult(double[] incoming)
          Get the result of evaluating the expression.
 java.lang.String getResultCategorical(double[] incoming)
          Gets the result of evaluating the expression when the optype is categorical or ordinal as the actual String value.
 void setFieldDefs(java.util.ArrayList<Attribute> fieldDefs)
          Set the field definitions for this Expression to use
 java.lang.String toString(java.lang.String pad)
           
 
Methods inherited from class weka.core.pmml.Expression
getExpression, getExpression, getFieldDef, getFieldDefIndex, getOptype, getResultContinuous, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Discretize

public Discretize(org.w3c.dom.Element discretize,
                  FieldMetaInfo.Optype opType,
                  java.util.ArrayList<Attribute> fieldDefs)
           throws java.lang.Exception
Constructs a Discretize Expression

Parameters:
discretize - the Element containing the discretize expression
opType - the optype of this Discretize Expression
fieldDefs - the structure of the incoming fields
Throws:
java.lang.Exception - if the optype is not categorical/ordinal or if there is a problem parsing this element
Method Detail

setFieldDefs

public void setFieldDefs(java.util.ArrayList<Attribute> fieldDefs)
                  throws java.lang.Exception
Set the field definitions for this Expression to use

Overrides:
setFieldDefs in class Expression
Parameters:
fieldDefs - the field definitions to use
Throws:
java.lang.Exception - if there is a problem setting the field definitions

getResult

public double getResult(double[] incoming)
                 throws java.lang.Exception
Get the result of evaluating the expression. In the case of a continuous optype, a real number is returned; in the case of a categorical/ordinal optype, the index of the nominal value is returned as a double.

Specified by:
getResult in class Expression
Parameters:
incoming - the incoming parameter values
Returns:
the result of evaluating the expression
Throws:
java.lang.Exception - if there is a problem computing the result

getResultCategorical

public java.lang.String getResultCategorical(double[] incoming)
                                      throws java.lang.Exception
Gets the result of evaluating the expression when the optype is categorical or ordinal as the actual String value.

Specified by:
getResultCategorical in class Expression
Parameters:
incoming - the incoming parameter values
Returns:
the result of evaluating the expression
Throws:
java.lang.Exception - if the optype is continuous

toString

public java.lang.String toString(java.lang.String pad)
Overrides:
toString in class Expression