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

Optional Rason Data Science Sections

Rason DM also features several additional optional sections that can be used to further refine the Rason model. These additional sections are: data, fittedModel, preProcessor and weakLearner.

"data"

Data arrays may be defined and calculated in this optional section, to be used later in a data science method. Scalars, arrays or tables containing scalars maybe be defined in the data section. If pulling data from an external source, this section may be used to "bind" the data to an array or table.

In the example code below, data from the qty column from the parts_data data source is assigned to the parts table. Note: A table is created here, rather than an array, by the use of the valueCol property.



  "data": {
    "parts": {
      "binding": "parts_data", "valueCol": "qty"
    }
  },

Properties available for data, are:

  • "name" – Used to define the table, array or scalar name.
  • "dimensions" – Defines a 1 or 2-dimensional array or table.
  • "value" – Defines the value of the array or table.
  • "valueCol" – Used with binding property to bind imported values from a readable data source.
  • "binding" – Allows data to be edited outside of the model from a URL or when calling the RASONTM interpreter to solve an optimization or simulation model.
  • "comment" – Use this property to enter a comment to describe the data.
  • "fittedModel"

    Used (only) when scoring a model. This section is similar to "datasets" but rather than refining imported data, this section defines a model that you can bind to when performing an "action" such as "forecast", "predict", "fit" or "transform".

    In the example below, a previously fit linear regression model previously POSTed to the RASON server is used to score the hald-small-score.txt dataset (which was imported into RASON as "dataSrc" and then bound to "myData").

      {
        "modelName": "PMMLRegressor",
        "modelType": "datamining",
        "modelDescription": "regression: linear model scoring from pmml",
        "datasources": {
          "dataSrc": {
            "type": "csv",
            "connection:" "hald-small-score.txt",
            "direction": "import"
          }
        },
        "datasets": {
          "myData": {
            "binding": "dataSrc"
          }
        },
        "fittedModel": {
          "mlrModel": {
            "modelName": "LinearRegression"
          }
        },
        "actions": {
          "myDataPrediction": {
            "data": "myData",
            "fittedModel": "mlrModel",
            "action": "predict",
            "evaluations": [
              "prediction"
            ]
          }
        }
      }
    

    This section includes two properties: "modelName" and "binding".

    • Use "modelName" when the fitted model is residing on the RASON Server.
    • Use "binding" when importing a file containing the fitted model.

    See the section above for an example of each.

    "preProcessor"

    This optional section may be used for preliminarily data preparation or to compute values of some properties, which are passed later, at parse-time, to the RASON DM engine. This section is parsed once, before the model is parsed.

    In the example below, "numLeafRecords", is defined within the "preProcessor" section and is then referenced within the estimator, "treeEstimator", to set the parameter, "minNumRecordsInLeaves".

    
    
     "preProcessor": {
        "numLeafRecords": {
          "formula: "INT(MAX(1, ROWS(myTrainData) / 10))"
        }
     },
     "estimator: {
        "treeEstimator": {
          "type": "classification",
          "algorithm": "decisionTree",
          "parameters": {
            "priorProbMethod": "EMPIRICAL",
            "minNumRecordsInLeaves": "numLeafRecords",
            "maxNumNodes": 5,
            "maxNumLevels": 3,
            "maxNumSplits": 10,
            "categoricalFeaturesNames": [ "X1" ],
            "prunedTreeType": "MIN_ERROR"
          }
        }
      },
    

    The properties available for this section include:

  • "name" -- Use this property to define the array name.
  • "dimensions" – Use this property to define a 1 or 2 dimensional array.
  • "value" – Use this property to set the value of the array.
  • "formula" – Use this property to enter the formula being calculated.
  • "comment" -- Use this property to enter a comment describing the formula.
  • "weakLearner"

    This section is only required when a bagging or boosting estimator is specified in "estimator", and is used to define the weak learner used in these algorithms.

    The following example defines the treeWeakLearner data source.

    
    
     "weakLearner": {
        "treeWeakLearner": {
          "type": "classification",
          "algorithm": "decisionTree",
          "parameters": {
            "minNumRecordsInLeaves": 2
          }
        }
      }, 
    
    

    In this example code snippet, weakLearner, "treeWeakLearner", is initialized to perform a classification (type: classification) using the decision tree algorithm as the weak learner for a bagging or boosting algorithm defined in within "estimator".

    The following parameters are available for this section:

  • "type" -- Type must be either "classification" or "regression".
  • "algorithm" -- Algorithm must be one of the following: "neuralNetwork", "decisionTree", "nearestNeighbors", "naiveBayes", "discriminantAnalysis", "logisticRegression", or "linearRegression".
  • "parameters" -- Properties for "parameters" will vary depending on the selected algorithm.