Implementation of scoring models

Scoring Engine supports scoring models in 4 formats: Java, PMML, Python or R code. Added codes can be queried by engine or used in scenarios.

Upload new model

Scoring code can be added in Scoring code management panel. To add a scoring code, click the Scoring code action button and select Upload new model option, then enter the name of the code and drag the file (or a .zip file in case of R models) with the code to designated area on the right side of the screen, or click this area and select the file with the code to add.

A .zip file containing R model must contain:

  • .R file with script containing transformations, calculations and/or models stored in RDS files. A variable with script output must be named rResult, RDS files can be used by refering to their names
  • CSV file with input variables (as described in Creating and testing a scenario section)
  • (optionally) RDS file(s) with model(s), these models can be used in the script by reference by file name. To save model as an RDS file, use saveRDS function in R.

a .zip file containg Python model must contain:

  • a .pkl file with a serialized python object.
  • CSV file with input variables (as described in Creating and testing a scenario section)
  • the .py file should contain a scoring function with access to input variables and model object unpickled from model.pkl

Sample Python model calculates a grade based on the given percentage .zip: Download

Sample file for creating a .pkl File

A list of added codes is presented on the bottom of the panel.

Import from json

Scoring code can be imported in Scoring code management panel. To import code click the Scoring code action button and select Import from json option, then drag the file with the code to designated area on the right side of the screen, or click this area and select the file with the code to add.

Export

To download all scoring codes in JSON file, click the Scoring code actions button and select the Export option.

Testing a code

Added codes can be queries in Forms panel. For this purpose, select a model from model drop-down list, enter proper values of displayed input variables (defined in the code), and then click the Query button. If the query is correct, output variables (defined in the code) will be displayed. Otherwise, the engine will display an appropriate error. Queries can be viewed in Browse scoring results panel, after choosing Scoring model or Pmml, R or Python model in Result type drop-down list.