Introduction to RASON
About RASON Models and the RASON Server
Rason Subscriptions
Rason Web IDE
Creating and Running a Decision Flow
Defining Your Optimization Model
Defining Your Simulation Model
Performing Sensitivity Analysis
Defining Your Stochastic Optimization Model
Defining Your Data Science Model
Defining Custom Types
Defining Custom Functions
Defining Your Decision Table
Defining Contexts
Using the REST API
REST API Quick Call Endpoints
REST API Endpoints
Decision Flow REST API Endpoints
OData Endpoints
OData Service for Decision Flows
Creating Your Own Application
Using Arrays, For, Loops and Tables
Organization Accounts

Using PMML Model to Score New Data

Open the example model, DT Loan Strategy model and Predictive CSV-XML.json, on the Editor page. This model imports a prediction model saved in PMML format and then uses that model to score new data contained in an external data file.

The RASON model begins with the dataSources section. The first datasource, score_src, holds the new data. See a screenshot of the data file below. The second datasource, pmml_src, contains the saved prediction model in PMML format.

score_src.txt pmml_src.txt

Click Download RASON Example Data (beneath RASON Examples) to download both files. Before posting this model to the RASON Server, you'll need to first click Choose Files and select both score_src and pmml_src to upload to the RASON Server.


  {
  modelName: "DTLoanStrategyPredictiveCSVXML",
  modelType: "calculation",

  datasources: {
  "score_src": {
  type: "csv",
  connection: "score_src.txt",
  colIndex: "score_h",
  direction: "import"
  },
  "pmml_src": {
  type: "xml",
  connection: "pmml_src.xml",
  content: "pmml- model",
  direction: "import"
  }
  },

The score_src data source, which holds the data to be scored, passes three arguments: type, connection and colIndex.

  • type specifies the file type, in this instance CSV, but any supported file type may be used including XML and JSON.
  • connection passes the name of the external data source.
  • colIndex passes the column headings in the external data source. Note: When using a PMML model to score new data, headings must be used in order to correctly map, or match, the variables in the new data with the variables in the saved PMML model.

The pmml_src data source, which contains the saved prediction model in PMML format, also passes three arguments: type, connection and content.

  • type specifies the file type, which can be "xml", "json", or "csv".
  • connection passes the name of the external data source.
  • content passes the content type within the data file which can be either 'pmml-model, 'xml-model' or 'json-model'. See the RASON Reference Guide for more information on supported XML/JSON formats.

The decisionTables section remains the same, so it is not displayed here. See the example above for more information on this section.

In the data section we use the "binding" property to bind the two data sources, score_src and pmml_src, to scoreData and pmodel, respectively.


data: {
    "scoreData": { binding: "score_src" },
    "pmodel": { binding: "pmml_src", comment: "pmodel" },
… (See the example above for the complete contents of this section)…
}

Both scoreData and pmodel are used as inputs to the PsiPredict() function within formulas. For more information on this function see the example above or Appendix II in the RASON Reference Guide.


formulas: {
"appRiskScore": { formula: "MIN(PsiPredict(pmodel,    scoreData),tblAppRiskScore(, , custAge, maritalStatus, employmentStatus))", 
 comment: "tblAppRiskScore", finalValue: [] },
…(See the example above for the complete contents of this section)…
}

To solve on the Editor page:

  • Click Post rason.net/api/model to post the model to the RASON Server.
  • Click POST rason.net/api/model/id/decision to start the calculation.
  • Click GET rason.net/api/model/id/status to check the status of the solve.
  • Click GET rason.net/api/model/id/result to obtain the result.

  Getting model results: GET https://rason.net/api/model/2590+DTLoanStrategyPredictiveCSVXML+2020-01-20-03-28-59-759652/result
  { "status": {
      "code": 0,
      "id": "2590+DTLoanStrategyPredictiveCSVXML+2020-01-20-03-28-59-759652",
      "codeText": "Solver has completed the calculation." 
    },
    "observations": {
       "appRiskScore": { "value": 20.568 },
       "bureauRiskCat": { "value": "high" },
       "bureauCallType": { "value": "full" },
       "eligibility": { "value": "eligible" },
       "strategy": { "value": "bureau" },
       "creditContFactor": { "value": 0.6 }
    }
  }
Back to Parametric Selection Feature