Models¶
Model Introduction¶
A model is any kind of equation that produces one or more output variables.
Common examples of models are:
- A model that forecasts the probability of default for a loan account based on external/macroeconomic variable values and a set of estimated parameters
- A model that estimates the covariance matrix between a set of risk factors based on historical values of those risk factors
- A model that predicts the future value of a corporate bond based on scenarios for interest rates and credit spreads, and the terms of the bond itself.
Models can be created, imported, exported, and viewed through the UI.
Model Definition Modes¶
Models support two definition modes:
- Freeform — Write custom model code in Go, Python, or SAS. This mode offers full flexibility to implement any computation. The rest of this page describes freeform model creation.
- Structured — Define a regression model declaratively by specifying predictors, coefficients, and a normalization method directly in the UI. No custom code is required. See Structured Models for full details.
You can switch between modes using the toggle button in the model editor.
Copying, exporting and versioning a model¶
There is no Copy or Save As. To branch a model, export it, rename the copy and import it back.
- Select the model and choose Export from its actions menu, or Export Models from the list's More actions menu to export several at once. The model is written as JSON. Exporting requires the model export permission.
- Change the
namefield in the exported file. - Choose Import Models from the More actions menu and select the file.
The import is keyed on the model name within the playpen, which is why the rename matters:
| The imported name | Result |
|---|---|
| does not already exist | a new, independent model is created |
| already exists | the import pauses and asks whether to keep the existing model or update it |
An import never overwrites a model silently: nothing in the file is written until that question is answered, the models that had no conflict included. Choosing update does write over the existing model, and what it replaced is retrievable only as an administrative task against the version history described below, not from the interface. Treat the rename, not the version history, as the safeguard.
The exported file is deliberately portable. Environment-specific values are stripped, and a structured definition's references to factors, dictionary columns and lookups are rewritten by name rather than by internal identifier, so a model can be moved between playpens.
Versions¶
Every save records a new version of the model, and those versions are kept in the application database. This happens automatically; there is nothing to enable.
The UI shows the current version number but does not offer a version list, a comparison or a rollback. Retrieving a prior version is an administrative task against the database rather than something a modeler can do from the interface.
Retaining a model for audit
If you need a copy of a model as it stood at a point in time, for an audit trail or before a what-if exercise, export it to JSON and keep the file with your working papers. That gives you an artifact you control and can read without database access, which the stored version history does not.
Creating Freeform Models¶
- Navigate to the Models tab.
- Create a new model by clicking the Model icon on the Models list panel on the left.
- In the Model Details section, enter a Model Name.
- In the Model Details section, select a Model Type from the drop-down menu.
- In the Model Details section, select a Model LOB from the drop-down menu.
- In the Model Details section, enter an optional Internal ID.
- In the Model Details section, enter an optional Pre-Process Flow.
- In the Model Details section, enter an optional Model Process Flow.
- In the Model Series section, add a model series by clicking the icon in the middle.
- In the Add Model Series pop-up screen, enter a link to a model document.
- In the Add Model Series pop-up screen, enter the model equations into the math editor. Then add the model series by clicking the Add button.
-
In the Model Script section, select the language in which the model script will be articulated from the drop-down menu.
Info
The following languages are available for model scripts:
- Plain Text
- Golang
- Python
- SAS
-
In the Model Script section, enter the model script in the model editor.
- Save the model by clicking the icon in the upper right corner. Then enter a comment in the Save Model pop-up screen and click the Save button.
- In the Model Process section, run the model by clicking the icon, and then click the Run button in the Run Options pop-up screen.