Creating a Technique Based on Scripts

Oracle Financial Services Enterprise Modeling application enables you to create techniques based on scripts. The supported scripting languages are R or ORE. After registering the techniques, they can be used in model definitions. In the Model Script tab, you can write the script in your preferred language. The Declaration Block in the script is used to declare the input and output parameters. The format of the declaration block and the content should not be altered. The scripting should start only from the line after the declaration block.
There are three types of input parameters that can be used in the script, namely Variable, Single Value Parameter, and Model Input. The input parameters can be defined from the Declaration block in the Script Console pane, or by right-clicking the parameter and selecting the Input type. The value of a single value parameter is defined from the Inputs window. However, the value of variables and model inputs are mapped during the model definition in which the technique is used.
You can configure the numeric output by declaring it in the Declaration block (## Output -->), or by right-clicking the parameter and selecting the Output type. It is not required to declare output parameters for plots or graphical outputs.
The script should be valid. You can use ORE functions instead of R functions for better performance in the R script. All the object names or functions used in the script should be syntactically valid. Validation of the script is not done while registering the technique. If you already have defined a technique using an R script and saved it in a .R file, you can upload it and register it as a technique.
To create a technique using scripts, follow these steps:
  1. Click Technique Registration from the Navigation list. The Technique Registration window is displayed.
  2. Click the Add icon from the Technique Registration toolbar. The Technique Definition window is displayed.

    Figure 7-3 Technique Definition


    This image displays the Technique Definition.

  3. Enter the details as described in the following table. Fields marked in red asterisk (*) are mandatory.

    Table 7-1 Technique Definition window Fields and its Description

    Field Description
    Technique Name Enter a name for the technique. Ensure that there are no special characters like `, {,},", ', ~, <,>, /, \, and multiple spaces.
    Technique Class Technique Class is used for logically grouping the techniques.
    1. Click and open the Technique Class Selection window.
    2. Right-click Technique Classes or the technique class name under which you want to create a technique class, and click Add Technique Class. Enter the technique class name in the Add Node window.
    3. Expand the Technique Classes tree, select the required technique class, and click the Forward Arrow icon.
    4. Remove a selected technique class by selecting the technique class and clicking the Backward Arrow icon.
    Technique Description Enter a brief description of the technique.
    Based On Select the Script option.
    Language Select the scripting language. The options are:
    • R
    • MATLAB
    Input Data Type Select the input data type.
    • For Hive-based Infodoms, the input data types are Data Frame and HDFS file.
    • For RDBMS-based infodoms, the input data types are RDBMS Data Frame and ORE Frame.
  4. In the Script Console pane, enter the R script for the technique. For more information on how to use fitting and prediction, see the Fitting and Prediction Using R Script section.

    Figure 7-4 Script Console


    This image displays the Script Console.

  5. By default, the Script Console is displayed as shown above. Enter the following details:
    • ## Variable --> Enter the variables you want to use in the R script separated by commas. You should map these variables to the corresponding variables which are available in the Variable Management window, during defining the model.
    • ## Single Value Parameter --> Enter the input parameters you want to use in the R script.
    • ## Model Input--> Enter the script variable names to which you want to load the output of another model in case of model chaining.
    • ## Output --> Enter the output parameters you want to use in the R script.
    • ## Model Output--> Enter the output object names you want to persist.

    Note:

    The variables and input parameters are case-sensitive. The same name cannot be used for both variable and input parameters.
  6. Click the Downward Arrow icon on the Script Console toolbar. The Inputs window is displayed.
  7. Enter Display Name for the Variables or Model Inputs you defined. The mapping of variables is done during the model definition.
  8. Enter Display Name and Value for single value parameters you defined.
  9. Select the parameter and click the Delete icon to delete it.
  10. Click the Upward Arrow icon from the Script Console toolbar. The Outputs window is displayed.

    Figure 7-5 Outputs window


    This image displays the Outputs window.

  11. Enter Display Name for the output parameter you defined.
  12. Click the Upload icon to browse and upload .R file. You can use this option if you have already defined a technique and saved it in an R file. Once uploaded successfully, the script is displayed in the Script Console pane.
  13. Select the Include Scripts tab if you want to source already defined algorithms to your script.
    • Select the required algorithms/ scripts from the Scripts List tree and click the Forward Arrow icon.
    • You can view the scripts by selecting the script and clicking the Book icon.
    • After adding scripts, you can position the scripts as required by selecting them and clicking the Upward Arrow and Downward Arrow icons.
  14. Click the Comments tab and click the Add icon to add additional information, if required.
  15. Click Save. If you have authorization privilege, then the technique is auto authorized and it can be used in creating models.