Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

Configuring custom functions of a PMML model

Updated on March 11, 2021

PMML functions transform data in PMML models. These models include several predefined functions that are defined as Java code in the Pega PMML execution engine. Additionally, PMML producers sometimes use proprietary expressions (functions) with the PMML models that are not part of the models themselves. These functions are used for various reasons (such as performance increase or enhancements). In such cases, the PMML model contains custom functions (the model contains only references to the functions and their parameters).

Perform this procedure to add missing functions to the PMML model.

  1. Open an instance of the Predictive Model rule and upload a PMML model.
  2. Click the Configurations tab.
  3. Define custom functions.

    • Click A function rule to define functions in the Pega Platform rule.

      • Select the appropriate ruleset, library, and function that implement the custom function logic.

        The rulesets and libraries are appropriately filtered to reflect the current application context.

    • Click An external Java class to define custom functions in a JAR file that is imported in the Pega Platform.

      1. Click Configure > Application > Distribution > Import.

      2. Import a JAR file with the proprietary expressions (functions) that you want to use with the PMML model.

      3. Return to the Configurations tab.

      4. Provide a name of the implementation class and method that are available in the JAR file.

        The Implementation class refers to the fully qualified name of the class implementing the function.

      5. Save the changes and restart the Pega Platform.

When you use custom functions, remember that a function takes a list of objects as argument. The order and type of the arguments is the same as defined in the PMML source definition. The output of the function must be the same type that is defined in the PMML source definition. Where applicable, you can use Java primitive types instead of the corresponding objects.

Example of a custom function

When you use a custom function in your PMML model like the one below:

public String exampleCustomFunction(List<Object> args) 
   { String geographyNumericCode = (String) args.get(1); 
   String geographySymbolicCode = (String) args.get(2);

   return geographyNumericCode + "/" + geographySymbolicCode;
}

and the model contains the corresponding data dictionary definitions:

<DataDictionary> 
   ...
   <DataField name="IMP_REP_CORP_GEOG_NUM" optype="continuous" dataType="double"/>
   <DataField name="IMP_REP_CORP_GEOG_SYM" optype="categorical" dataType="string"/>
   ...
</DataDictionary>

<DerivedField name="IMP_REP_CORP_GEOG_CONTINENT_NM+" optype="categorical" dataType="string">
   <Apply function="SAS-FORMAT-$CHARw">
      <FieldRef field="IMP_REP_CORP_GEOG_NUM"/>
      <FieldRef field="IMP_REP_CORP_GEOG_SYM"/>
   </Apply>
</DerivedField>

Inputs to the defined function are provided in a list with two objects:

  • java.lang.Double
  • java.lang.String

The return value from the function is an object of the java.lang.String type.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us