Importing a risk model
We will create our first block in our Rate project by importing the frequency model we built during the Risk tutorial. In the operations bar, click
or use the keyboard shortcut M .
A screen will pop up that allows to select from importing a Risk model, importing a Demand model, or building a model from scratch. Start by clicking Risk, then navigating to the Risk model you created during the tutorial. Click NEXT in the bottom right.
Now we see the model tree and all of the tagged models from our Risk project. We will select our final model that included Geography and Classifications of both Geography and Vehicle. Then click ADD MODEL in the bottom right.
Before the model is imported, Akur8 will give us the ability to set the mapping of the model with Rate database. It will auto suggest a mapping based on the Risk model.
Since this Risk project was created with the same database as our Rate project, the mapping should line up well. However, this may not be the case when when the models trained on a different database. This tool allows you to verify the columns and levels match, the predictor type is correct, set up the Geography definition if it cannot be found.
Notice the column with the mapping score. This score is a rough measure of how well the Risk model matches to the Rate database. Half of the score is attributable to the column name matching, and the other half of the score is attributable to the levels matching. We can hover over the bars to get more detail about the scores for names and levels.
Note: The matching score for our GEO variable zip is not coming back with 100% match. This is normal for GEO variables that have many levels and can be ignored. The Geography will be mapped and scored correctly.
If a variable did not match up, we can click the change variable drop down for the row in question. This will give us more details on the matching score, the ability to map a different variable, and the ability to edit the coefficients. The latter is useful if the correct levels exist but have a new format from when the model was trained. For example, the model had a column with 1's and 0's, but the new database has TRUE and FALSE, we can easily edit the coefficients to apply them how we want without retraining the model.
Tip: Under the Change variable menu, we can also allow a variable to have no mapping. This will effectively neutralize the effect of this variable in the model.
Once we have confirmed the mapping, we click APPLY in the top right. We now have the model represented as a block in our Rate project!
Step-by-Step: Creating Model Block
In the operations bar, click
or use the keyboard shortcut M .
Click Risk in the top left of the pop-up window, navigate and select the risk project you created during the Risk tutorial and click NEXT in the bottom right.
Select your final model that includes both geography and classification and then click ADD MODEL in the bottom right.
Ensure that the displayed matching scores are appropriate and then click APPLY in the top right.
Examining model blocks
When we left click to select our block, we'll notice a small menu pops up:
The
icon provides settings and actions for the block, including the ability to rename the block and the ability to delete it. We can also access these options by right clicking on the block. When the block is selected, we can also use the shortcuts Shift + Rto rename andDeleteto delete the block.The
icon lets us explore the block. Since we have not yet computed this block, we will wait to use this feature.
Step-by-Step: Rename Block
Select the model block and then click
Click Rename block.
Rename the block to "PD Frequency".
Click RENAME BLOCK in the bottom right of the pop-up window.
Model block sidebars
The sidebar is opened by default. You can open or close it using the chevron below the EXPLORE button.
The sidebar will vary depending on the type of block. Let us familiarize ourselves with the sidebar for model blocks.
Inputs: This section shows us the inputs to the block. In this case, it is the tagged model we imported. We also have the option to revisit the variable mapping by clicking EDIT MATCHING.
Premium edits: Premium edits allow us to edit the coefficients from our model, such as when we make an actuarial selection to override a raw output of the model. We will later see that we can have multiple versions of premium edits and pair them to different scenarios in our rate project.
Parameters: The parameters are used to create visualizations and performance metrics for the block. We can explore model blocks without setting these parameters and it will score the data as we expect, but we will lose some of the diagnostics. We can click PARAMETERS to edit these if needed.
Status: The status section shows us the various metrics and visualizations that this block will produce such as prediction histograms and loss related metrics. The icons on the left denote the status of these items:
Inactive
: the item is inactive, likely because the block is missing a required parameter or input. For example, target visualization is not available if the target parameter is not set.Ready
: the item has all the necessary parameters and inputs and is ready to be computed.Available
: the item has been computed and is available for review.Alert
: After attempting to compute, Akur8 observed that some input or parameter is not set up correctly. Use the right arrow to expand and get more details.Error
: There was an error in the computation. Review the error messages and contact support if the issue persists.
Notice that the status for Target visualisation and Loss-related metrics are Inactive. We can change these to Ready by defining the parameters.
Step-by-Step: Defining Parameters
Click on the
button within the Parameters section of the sidebar.
Toggle on Add target and set the Target as target__claims_PD
Toggle on Add exposure variable and set the exposure variables as contract_duration
Toggle on Divide the target by the exposure (e.g. Frequency)?
Set loss type as "POISSON"
Click APPLY
We see that the status for each item is now ready for computation as denoted by
. We are ready to compute our block. At the bottom of the sidebar, click the COMPUTE button. We will discuss computing in greater detail once our project is more complex, but for now we can proceed. After a moment we should see that the status for each item has changed to
.
Step-by-Step: Compute a Block
Open the sidebar of the PD Frequency block
Click the COMPUTE Button on the bottom right
Build a model from scratch
Initialize model
Before we explore our frequency model, let's first build a Model from scratch for Severity. In the operations bar, click
or use the keyboard shortcut m. This time, select Build.
This process will allow us to create a multiplicative log-link GLM from scratch without leaving the Rate module. Here we have the option to set the initial average value, which is defaulted to 1. We can change the average value of this block later so keep this default value for now. Set the name as "PD Severity" and then click ADD MODEL in the bottom right to continue.
A new screen pops up that looks similar to the edit coefficients feature in Risk and allows us to start programming our model. Every variable in the dataset is available to us. When a variable is selected, we see the factor curve displayed against the exposures for each level. We also have an ACTIONS pane where we can visually modify selected points as well as a VALUES pane where we can paste in values. At the top, we also have the ability to edit the name and fix the average value.
Define coefficients
Search for the variable vehicle_value_at_purchase and navigate to the VALUES pane. Copy the values from the below values and paste directly into the Coefficient % column.
COEFFICIENT % |
-9.99 |
-8.88 |
-7.77 |
-6.66 |
-5.55 |
-4.44 |
-3.33 |
-2.22 |
-1.11 |
0 |
1.11 |
2.22 |
3.33 |
4.44 |
5.55 |
6.66 |
7.77 |
8.88 |
9.99 |
Now we have the coefficients for our one variable severity model programmed. Note, if you wanted to define more variables you would simply repeat the steps above. Click APPLY in the top right and the block will appear in our rate project.
Step-by-Step: Create Severity Model Block From Scratch
In the operations bar, click
or use the keyboard shortcut M .
Click Build on the left side.
Click ADD MODEL in the bottom right.
Define coefficient Values as described in the Define Coefficients section above.
Click Apply in the top right.
Now that the severity block is created, follow the steps below to define this block's parameters.
Step-by-Step: Defining Parameters
Open the sidebar by double clicking on the "PD Severity" block.
Click on the
button in the Parameters section of the sidebar.
Toggle on Add target and set the Target as target__claims_cost_PD.
Toggle on Add exposure variable and set the exposure variables as target__claims_PD.
Toggle on Divide the target by the exposure (e.g. Frequency)?.
Set loss type as "GAMMA".
Click APPLY.
Notice the difference in shades between the two blocks. Each type of block has a designated color. In this case, model blocks are blue. The shade denotes if it has been computed or not. The darker shade for our Frequency model denotes that is has been computed, while the severity model is denoted by a lighter shade since it has not. Lets compute the severity block now.
Step-by-Step: Compute Severity Model Block
Open the sidebar of the PD Severity block.
Click the COMPUTE Button on the bottom right.
Exploring model blocks
We can explore the model blocks now that they have been computed. Select the Frequency block and click EXPLORE.
On the left of this window, we have a bar that displays the other blocks that can be explored. This allows us to quickly toggle across blocks without having jump back to the main workflow.
On the right, we have 3 panes:
Prediction: A exposure histogram of the model scores and summary statistics. Note, if no parameters were defined for this block this histogram would be weighted by row count as opposed to exposure.
Overview: Model level summary similar to the Risk section when clicking into a model. The only difference is that there are no metrics for various folds, only the full Rate dataset.
Variables: Variable level plots similar to the Risk section when clicking into a model. The only difference here is that we do not have the ability to edit coefficients. This can be done with the Edit Premium feature which will be discussed in a later chapter.
Construct a pure premium
Now that we have both frequency and severity blocks, we can combine them into a pure premium using the product operation.
Step-by-Step: Construct Pure Premium
Click the button
within the operation bar.
Title the block name PD Pure Premium.
Define Input 1 as "PD Frequency".
Define Input 2 as "PD Severity".
Click APPLY.
After creating the PD Pure Premium block, notice the following:
Lines now come out of the left side of the PD Frequency and PD Severity blocks and connect into the right side of the PD Pure Premium block. This indicates that PD Frequency and PD Severity blocks are inputs to the PD Pure Premium block. This can also be seen by examining the Inputs section of the PD Pure Premium block's sidebar
The PD Pure Premium block is a lighter shade indicating that it has not yet been computed
No parameters are defined and therefore the Status of the "Target visualisation" and "Loss-related metrics" is Inactive
Lets set the parameters and compute this block:
Step-by-Step: Set Parameters and Compute Pure Premium Block
Define the parameters as follows:
Target = target__claims_cost_PD
Exposure = contract_duration
Toggle on "Divide the target by the exposure (e.g. Frequency)"
Loss type = TWEEDIE
P = 1.5
Compute the PD Pure Premium Block.
Now that this block is computed you can explore it in the same way that you explored the frequency and severity blocks. Notice that the overview and variable tabs are still populated. When multiplying two multiplicative GLM blocks together the resulting block will also be a multiplicative GLM. This feature will be extremely helpful when making selections and defining scenarios later.
NEXT: Dislocation Analysis











