How Actuaries and Data Scientists
could learn from each otherXavier Conort
Chief Data Scientist @DataRobot
September 2018

1991-1998:
1999-2007:
2008-2011:2011-2013:2013-now:

AGENDA• What are GLMs and why do Actuaries like to use them?
• Why do Data Scientists prefer Machine Learning? and what do they fail tolearn from GLMs?
• Machine Learning initiatives, that successfully incorporate GLMs features• How can Actuaries benefit from Machine Learning• How to further improve Regularized Generalized Linear Models

Confidential. Copyright © DataRobot, Inc. - All Rights Reserved

What are GLMs and why do Actuaries
like to use them?

What Actuaries needs
Actuaries have to deal with•••

Risks with severity that follows skewed distributions
Risks that tend to vary multiplicatively with rating factors
Pricing constraints:
○
○
○

•

pricing that is pro-rata to the policy durationcommercial discounts
small changes vs previous pricing

Regulatory constraints:○○

transparency
known relationships between risk and risk factors■ example: risk expectation should always increase with the sum insured

We will see that GLMs structure is very relevant to Actuaries needs
Confidential. Copyright © DataRobot, Inc. - All Rights Reserved

What are GLMs

Confidential. Copyright © DataRobot, Inc. - All Rights Reserved

GLMs variance function

In practice, Actuaries use GLMs with a poisson (frequency modeling), gamma(severity modeling) or tweedie (cost modeling) distribution to deal with risk severity
that follows skewed distributions.
By using a Gamma distribution, Actuaries inform the model that the expectedvariance increases with the square of the expected value of each observation.
This is important because:• This first reflects a reality: larger a risk is, larger its dispersion is.
• It second prevents Actuaries from overfitting observations with largevalues.
○Indeed more tolerance is given to the deviation of the observed value with its expected value if
this expected value is high.
Confidential. Copyright © DataRobot, Inc. - All Rights Reserved

GLMs link function

Log link function is also very much used in practice by actuaries. This helps:● ensure that predicted value is non negative● build a model that takes into account the fact that most insurance risk vary
multiplicatively with rating factors

Important note: applying a linear model to the log of Y values (instead of a GLM
with a log link function) is not recommended as this leads to biased predictedvalues. Indeed, log(E(Y)) is different to E(log(Y)). If you do this, don’t forget toadjust your predictions or you will predict the median of the cost instead of themean
Confidential. Copyright © DataRobot, Inc. - All Rights Reserved

OffsetOffset is an awesome feature that allows Actuaries to incorporate constraints orstrengthen their modelling strategy:● they can ensure that predicted value is proportional to the exposure●●

they can apply arbitrary discount to some part of the population
they can include a priori effects derived from:
○
○
○

●

other larger, similar products
market practiceprevious pricing

they can build a model in multiple stages:○○

first stage will focus on primary features that are fully trusted
second stage will capture the marginal effects of features that are less trusted and lesscommonly available

Confidential. Copyright © DataRobot, Inc. - All Rights Reserved

Additional GLMs features
Some actuaries use:
● splines to learn non-linearity○●binning to capture non-linearity○●●

those need to be manually defined and can computationally expensive
bins should not be too small such that they contain enough statistical materialinteractions to learn complex relationships
mixed models to handle categorical features with high cardinality

Confidential. Copyright © DataRobot, Inc. - All Rights Reserved

Why do Data Scientists prefer
Machine Learning? Are they discarding
GLM features too fast?

Data Scientists work with too many features for GLMs
Building a GLMs is very time consuming. Actuaries need to manually check thestatistical significance of each factor (via p-values) and then remove theundesirable factors from the model. This is not practical in presence of large
number of features or unstructured data such as text.
Data Scientists prefer automated regularization embedded in Machine
Learning algorithms.
One of the most popular ML algorithms is the Regularized GLMs (a very close
cousin to GLM!) where a penalty is added to the GLMs loss function. This forces
the model to automatically shrink to 0 coefficients of undesirable factors
Regularized loss function = GLM loss function +If lambda2 is 0, it is a LASSO penalty. If lambda1 is 0, it is a RIDGE penalty. If none are zeros, it is an elastic-net penalty
Confidential. Copyright © DataRobot, Inc. - All Rights Reserved

Data Scientists want to learn automatically complex signal
Data Scientists love Machine Learning (ML) algorithms that can automatically
capture non-linearity and interactions between factors.
This helps them be very productive and get strong accuracy without much effort
while building a complex GLMs requires Actuaries strong familiarity with the data,
significant effort and expertise.
It is common to hear that ML helps speed up projects from X months to X weeks.
With Automated ML (automated preprocessing, automated hyper-parameters
tuning, automated model selection), this can be further reduced to X days or evenless.
Popular ML algorithms that are good in catching complexity:● Gradient Boosting Machine● Random Forest● Neural Network● Support Vector Machine
Confidential. Copyright © DataRobot, Inc. - All Rights ReservedGLMs features Data Scientists should know betterwellknownlittleknown

By discarding too fast GLMs from their toolbox, Data Scientists often fail to learn
the benefits that some GLMs features can offer:● less risk to overfit large values thanks to the use of poisson, gamma,
tweedie loss functions● multiplicative structure thanks to the log link function that can help thealgorithm find more easily the signal● ability to incorporate known effects, control bias or do boosting via theuse of offset
Confidential. Copyright © DataRobot, Inc. - All Rights Reserved

Example of offset to control bias
The use of offset was critical in my solution to win the GE Flight Quest, acompetition where I had to predict flights delays in USA.
I wanted the machine:● to learn a flight is late because of bad traffic and badweather● and not to learn that one airport will never have delaysin the future because there have not been any delayin this airport for the past 3 months
To achieve this, I used a 2 stages modeling (approach I learnt from actuaries!):• first I fitted one GBM with features that I believed strongly related to delays• then, I fitted one Regularized GLM with the GBM predictions as offset andother variables such as the name of the airport as features
Confidential. Copyright © DataRobot, Inc. - All Rights ReservedMachine Learning initiatives, thatsuccessfully incorporate GLMsfeatures

Xgboost

Confidential. Copyright © DataRobot, Inc. - All Rights Reserved

Xgboost

Confidential. Copyright © DataRobot, Inc. - All Rights Reserved

Why Actuaries and Data Scientists should be excited

Gradient Boosting Machine (implemented by xgboost) is a close cousin to GLMs.
The only difference is:● the design matrix X is not defined by the user but is a set of thousands ofrules found in a stagewise manner by the Machine.
● the coefficients beta are learnt slowly by the Machine.
● early stopping is used when accuracy improvements are too low
Actuaries can apply GBM to their risk modeling in a very similar way to what they
do with GLMs
On the other hand, Data Scientists can add Actuaries tricks to their toolbox(exponential distributions, link function, offset...).
Confidential. Copyright © DataRobot, Inc. - All Rights Reserved

Other Machine Learning initiatives
Offset support
Xgboost (GBM), H20 (GBM, ElasticNet, NN), DataRobot (GBM, ElasticNet, SVM), R gbm, R glmnet(ElasticNet)

Poisson support for claim frequencies
Xgboost (GBM), LightGBM (GBM), H20 (GBM, ElasticNet, NN), DataRobot (GBM, ElasticNet, NN, SVM),
R glmnet (ElasticNet), pyglmnet (ElasticNet)

Gamma support for claims severities
Xgboost (GBM), LightGBM (GBM), H20 (GBM, ElasticNet, NN), DataRobot (GBM, ElasticNet, NN, SVM),
pyglmnet (ElasticNet)

Tweedie support for total claim cost (frequency x severity)
Xgboost (GBM), LightGBM (GBM), H20 (GBM, ElasticNet, NN), DataRobot (GBM, ElasticNet, NN, SVM),

Confidential. Copyright © DataRobot, Inc. - All Rights Reserved

How Actuaries can benefit from
Machine LearningMachine Learning (ML) benefits for Actuaries
Thanks to ML, Actuaries can● Be more productive => More use cases● Benchmark existing models● Explore faster new data to enrich existing solutions.
● Improve existing models structure thanks to ML insights

explore new data value
thanks to ML feature impact

How can you improve existing models thanks to ML?
● learn optimal boundaries (from partial dependence plots) when you do binningto capture non-linearity● add most impactful interactions found by ML● improve modelling of categorical variables
Challenge: adding higher complexity to a GLM structure increases the risk ofoverfitting
Confidential. Copyright © DataRobot, Inc. - All Rights Reserved

Automated Binning
Learn from xgboost
Partial Dependence

Find boundaries thatbest approximate
the xgboost Partial
Dependence

Confidential. Copyright © DataRobot, Inc. - All Rights Reserved

Risk of overfitting a complex structure
Creating (granular) bins from numeric features, adding levels of categoricalfeatures and adding interactions increase the risk of overfitting
Unfortunately, using traditional (Ridge or Lasso) GLMs won’t help as informationon the ordinal nature of bins is lost. For small bins with little statistical information,
the Ridge or Lasso penalty will fail to assign a value close to the coefficients ofadjacent bins.
Predictions for thisbin seem very noisy.
And there is too little
data to make thebin’s results
credible.

Confidential. Copyright © DataRobot, Inc. - All Rights Reserved

How to reduce risk of overfitting of a complex structure
Here is the solution I developed for DataRobot’s Generalized Additive Modelto reduce the risk of overfitting small bins
Instead of fitting a GLM with• Target ~ complex model structure, offset=O, link_function=L, distribution=d
I use a surrogate model as the strategy to combat overfitting.
I fit first a GBM with the same target, offset, link_function and distribution.
Then fit a Linear Model with• GBM_margin_predictions ~ complex model structure

Confidential. Copyright © DataRobot, Inc. - All Rights Reserved

Results look much lessnoisy.
Indeed, GBM didn’t
capture the noise in thedata thanks toregularisation and theordinal nature of thefeature that is exploitedby GBM

Build your own surrogate model●Fit your favorite ML algorithm:○●

Learn from the algorithm’s insights for feature engineering:
○
○

●

○
○

Apply the link function to the in-sample predictions of your ML algorithm (margin predictions)and use this as a target
Fit a linear model with the features you derived from the ML insights
Apply the inverse link function to the linear model predictions

Find interactions:○○●feature impact to select factors
partial dependence plots for each factor to bin numeric features or decide on the formula

Fit a “main effects” model○●

Use one that supports link function, exponential distributions and offset if you need touse interactions reported by the ML algorithm if it exists (supported soon in DataRobot)
or look for interactions that best explain the residuals between your “main effects” solution andthe predictions of your favorite ML algo

Fit selected interactions on the residuals
Confidential. Copyright © DataRobot, Inc. - All Rights Reserved

How to further improve Regularized
Generalized Linear Models

This is an emerging hot topic in insurance
Last year during my visit in Japan, Iwasawa-san, a famous actuary in Japan,
convinced me that the potential of Regularized Generalized Linear Models has notbeen fully exploited yet and Fused Lasso could be of great interest to Actuaries.
Thanks to him, I discovered that Fused Lasso can allow data driven risk factor
binning, levels grouping and spatial (or interactions) modeling within a GLM
framework and combat the risk of overfitting small bins!
In the meantime, my brother in France shared with me very good slides fromBelgium actuarial researchers that say exactly the same thinghttps://rininsurance17.sciencesconf.org/data/Devriendt.pdf

Confidential. Copyright © DataRobot, Inc. - All Rights ReservedAccording to the researchers, magic comes from new penalties

Unfortunately, no implementation is available yet except for the R genlasso
package that supports only the gaussian distribution
Confidential. Copyright © DataRobot, Inc. - All Rights Reserved

Takeaways

Takeaways
Data Science took time to embrace Actuaries practices.
On the other end, Actuaries have resisted to Machine Learning innovations.
We can now observe interest on both sides and that more Machine Learningalgorithms support features that are essential for Actuaries but also useful for Data
Scientists.
More innovations are expected in the future.
New approaches such as surrogate models and Fused Lasso are good examplesof emerging techniques that could change how both Actuaries and Data Scientists
work.

Confidential. Copyright © DataRobot, Inc. - All Rights Reserved

Questions
Confidential. Copyright © DataRobot, Inc. - All Rights Reserved