Package weka.core.pmml

# Class DefineFunction

java.lang.Object
weka.core.pmml.Function
weka.core.pmml.DefineFunction

All Implemented Interfaces:
  `Serializable`

public class DefineFunction extends Function
Class encapsulating DefineFunction (used in TransformationDictionary).

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

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefineFunction(Element container, weka.core.pmml.TransformationDictionary transDict)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Attribute`
  `getOutputDef()`
  Get the structure of the result produced by this function.
  `String[]`
  `getParameterNames()`
  Returns an array of the names of the parameters expected as input by this function.
  `double`
  `getResult(double[] incoming)`
  Get the result of applying this function.
  `void`
  `pushParameterDefs()`
  `void`
  `setParameterDefs(ArrayList<Attribute> paramDefs)`
  Set the structure of the parameters that are expected as input by this function.
  `String`
  `toString()`
  `String`
  `toString(String pad)`

  ### Methods inherited from class weka.core.pmml.Function

  `getFunction, getFunction, getName`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### DefineFunction

    public DefineFunction(Element container, weka.core.pmml.TransformationDictionary transDict) throws Exception
    Throws:
      `Exception`

- ## Method Details

  - ### pushParameterDefs

    public void pushParameterDefs() throws Exception
    Throws:
      `Exception`

  - ### getOutputDef

    public Attribute getOutputDef()
    Get the structure of the result produced by this function.
    Specified by:
      `getOutputDef` in class `Function`
    Returns:
      the structure of the result produced by this function.

  - ### getParameterNames

    public String[] getParameterNames()
    Returns an array of the names of the parameters expected as input by this function. May return null if this function can take an unbounded number of parameters (i.e. min, max, etc.).
    Specified by:
      `getParameterNames` in class `Function`
    Returns:
      an array of the parameter names or null if there are an unbounded number of parameters.

  - ### getResult

    public double getResult(double[] incoming) throws Exception
    Get the result of applying this function.
    Specified by:
      `getResult` in class `Function`
    Parameters:
      `incoming` - the arguments to this function (supplied in order to match that of the parameter definitions
    Returns:
      the result of applying this function. When the optype is categorical or ordinal, an index into the values of the output definition is returned.
    Throws:
      `Exception` - if there is a problem computing the result of this function

  - ### setParameterDefs

    public void setParameterDefs(ArrayList<Attribute> paramDefs) throws Exception
    Set the structure of the parameters that are expected as input by this function. This must be called before getOutputDef() is called.
    Specified by:
      `setParameterDefs` in class `Function`
    Parameters:
      `paramDefs` - the structure of the input parameters
    Throws:
      `Exception` - if the number or types of parameters are not acceptable by this function

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Function`

  - ### toString

    public String toString(String pad)
    Overrides:
      `toString` in class `Function`