Library · Statistics

GLM or gradient boosting for insurance pricing

A generalised linear model gives a tariff anyone can read: a base rate and one multiplier per factor. Gradient boosting usually predicts better because it picks up interactions and non-linear effects without being told. Most of that gain can often be carried back into a GLM.

By , published

Definition

A Poisson GLM with a log link assumes that each rating factor multiplies the claim frequency by a constant, whatever the values of the other factors. A gradient boosting machine (GBM) builds the prediction as a sum of many small trees, each correcting the previous ones; trees split on several variables in turn, so combined effects are learned automatically.

Both are scored the same way: the Poisson deviance of predicted against observed claim counts on policies held out. Henckaerts and co-authors compared the two families on a motor portfolio and found boosting ahead on predictive accuracy, with a tariff structure that remained explainable.

Worked example

Claim frequency depends on driver age, vehicle power and one interaction: young drivers in powerful cars are riskier than the two factors alone imply. Three models are compared on held-out policies.

import numpy as np
from sklearn.ensemble import HistGradientBoostingRegressor
from sklearn.linear_model import PoissonRegressor
from sklearn.metrics import mean_poisson_deviance

rng = np.random.default_rng(33)
def portfolio(n):
    age = rng.uniform(18, 80, n)
    power = rng.uniform(4, 15, n)
    young = age < 26
    lam = np.exp(-2.4 + 0.5 * young + 0.04 * (power - 9) + 0.12 * young * (power - 9))
    return age, power, young, rng.poisson(lam), lam

age, power, young, y, _ = portfolio(120_000)
age_t, power_t, young_t, y_t, lam_t = portfolio(120_000)
main = lambda a, p, yg: np.column_stack([yg, p - 9])
inter = lambda a, p, yg: np.column_stack([yg, p - 9, yg * (p - 9)])
raw = lambda a, p, yg: np.column_stack([a, p])

glm = PoissonRegressor(alpha=0, max_iter=1000).fit(main(age, power, young), y)
gbm = HistGradientBoostingRegressor(loss="poisson", max_iter=200, learning_rate=0.05, random_state=0).fit(raw(age, power, young), y)
glm2 = PoissonRegressor(alpha=0, max_iter=1000).fit(inter(age, power, young), y)

dev = lambda pred: mean_poisson_deviance(y_t, pred)
floor = dev(lam_t)
print(f"deviance of the true rates (the floor):   {floor:.4f}")
for name, pred in [("GLM, main effects", glm.predict(main(age_t, power_t, young_t))),
                   ("gradient boosting, raw age and power", gbm.predict(raw(age_t, power_t, young_t))),
                   ("GLM with the interaction added", glm2.predict(inter(age_t, power_t, young_t)))]:
    print(f"{name:40s}  {dev(pred):.4f}   excess over the floor: {dev(pred) - floor:.4f}")

Output, produced by running the code above when this page was built:

deviance of the true rates (the floor):   0.4706
GLM, main effects                         0.4725   excess over the floor: 0.0019
gradient boosting, raw age and power      0.4715   excess over the floor: 0.0008
GLM with the interaction added            0.4706   excess over the floor: -0.0000

Boosting, given only raw age and power, comes closer to the floor than the GLM with main effects: it found the young-driver threshold and the interaction by itself. The GLM with the interaction term added does at least as well, with three coefficients.

How to choose

  • The differences in deviance are small in absolute terms because claims are rare: most of the deviance is noise that no model removes. Compare models on the excess over a reference, with a paired interval, not on the raw figure.
  • A boosted model is a way to find what the GLM misses. Interactions and thresholds read from it can be added to the GLM, which keeps a tariff that a regulator, an underwriter and a client can follow.
  • Boosting has settings to tune, and tuning on the test set produces the gain it claims to measure, see nested cross-validation.
  • Accuracy is not the only criterion for a price. A tariff must be stable from year to year, monotonic where the business expects it, and free of factors the law forbids.

In our work

On the public French motor liability data, our model ranked first of nine published scores, in one to three days of work. We deliver the benchmark GLM alongside any machine learning model, with the paired gain and its interval.

References

  1. Henckaerts, R., Côté, M.-P., Antonio, K., Verbelen, R. (2021). Boosting insights in insurance tariff plans with tree-based machine learning methods. North American Actuarial Journal, 25(2), 255-285. doi:10.1080/10920277.2020.1745656
  2. Noll, A., Salzmann, R., Wüthrich, M. V. (2018). Case study: French motor third-party liability claims. SSRN working paper. doi:10.2139/ssrn.3164764
  3. Wüthrich, M. V., Merz, M. (2023). Statistical foundations of actuarial learning and its applications. Springer, Cham. doi:10.1007/978-3-031-12409-9

Have a question like this one on your own data? Tell us what you need in a few lines.

Send us the brief

Related pages

  • Poisson GLM with an exposure offsetA policy observed for three months cannot be compared with one observed for a year. In a Poisson model of claim frequency, exposure enters as an offset: the logarithm of the exposure, with a coefficient fixed at 1.
  • The Tweedie GLM for pure premiumMost policies have no claim in a year, and the few that do have costs spread over a wide range. The Tweedie distribution, with a power between 1 and 2, describes that mix in one model of the pure premium.
  • Paired comparison of two modelsTwo models tested on the same rows share most of their luck. Comparing their two confidence intervals ignores that. The interval of the difference, computed on the same resampled rows, is much narrower.
All library pages