ML research · UK personal lines insurance

Your GBM outperforms.
Your GLM is still live.

Ten libraries for the hard problems in UK pricing. Free, MIT-licensed, Databricks-native. All libraries also work standalone via pip — Databricks is optional.

shap_relativities_demo.py
524 Articles
25,000+ PyPI Downloads / month (March 2026)

25,000 downloads in March 2026 across 34 libraries

Real adoption from pricing teams — each download is a pip install on someone's work machine or Databricks cluster. Without-mirrors counts only, stripping CI bots and PyPI mirrors.

Library Downloads / month
insurance-causal
2,003
insurance-fairness
1,992
insurance-monitoring
1,622
insurance-causal-policy
1,495
insurance-gam
1,120
insurance-optimise
1,099
insurance-conformal
1,010
insurance-quantile
968
insurance-credibility
909
insurance-severity
846
Top 10 total 13,064 / month

Five libraries, one dataset, one notebook

A runnable example that fits a CatBoost frequency model, extracts SHAP factor tables, runs a proxy discrimination audit, monitors for drift, and attaches conformal prediction intervals — all on the same synthetic UK motor dataset. Opens in Google Colab with no local setup required.

Uses: shap-relativities · insurance-fairness · insurance-monitoring · insurance-conformal

The missing piece is not technical skill. It is tooling that bridges the two.

Most UK pricing teams have adopted GBMs but are still taking GLM outputs to production. The GBM sits on a server outperforming the production model, but the outputs are not in a form that a rating engine, regulator, or pricing committee can work with. The model never makes it to rates.

Each library here solves one specific problem in the pricing workflow. Actuarial tests are included. Outputs use the formats pricing teams already recognise: factor tables, Lorenz curves, A/E ratios, movement-capped rate changes.

sklearn-compatible where it matters. Documented by people who have sat in the same sign-off meetings you have.

Three lines to a factor table. Five to validated splits.

Real API calls from the libraries. Not wrappers around wrappers. Each one does the specific thing a pricing team needs.

from shap_relativities import SHAPRelativities sr = SHAPRelativities(model, X_train) factors = sr.fit_transform(X_test) # Returns multiplicative factor tables in GLM format # Same structure as exp(beta) from your Emblem model factors.head() # vehicle_age relativity ci_lower ci_upper # 0 1.000 0.982 1.018 # 1 0.912 0.901 0.923 # 3 0.793 0.780 0.807 # 4+ 0.754 0.739 0.769
Factor tables, confidence intervals, exposure weighting, reconstruction validation. Output goes straight into a pricing committee pack.
from insurance_cv import InsuranceTemporalCV from sklearn.model_selection import cross_val_score cv = InsuranceTemporalCV( n_splits=5, ibnr_buffer_months=6 ) scores = cross_val_score( model, X, y, cv=cv, scoring="poisson_deviance" ) # Walk-forward splits - no future data leaks into training folds # IBNR buffer prevents immature periods contaminating validation print(f"CV deviance: {scores.mean():.4f} ± {scores.std():.4f}")
Walk-forward splits with configurable IBNR buffers. Temporally correct: no future data leaks into training folds. sklearn-compatible API.
from insurance_optimise import RateOptimiser opt = RateOptimiser( current_rates, technical_rates, exposure ) result = opt.optimise( max_movement=0.10, target_lr_improvement=0.03 ) # Efficient frontier as a linear programme # Respects ±10% movement cap per segment print(f"LR improvement: {result.lr_delta:.1%}") # LR improvement: 2.8% (within movement constraints)
Formulates the efficient frontier as a linear programme. Respects movement caps per segment, targets aggregate loss ratio improvement.

Built for people who know the problem from the inside

These libraries assume you understand insurance pricing. They do not explain what a GLM is.

PA
Pricing actuaries moving from Emblem or Radar to Python

You know the techniques. These libraries give you Python equivalents that produce outputs in the same formats you already use: factor tables, A/E ratios, Lorenz curves.

DS
Data scientists joining an insurance pricing team

You have the ML skills but lack the actuarial context. These libraries encode that context: correct cross-validation for IBNR, credibility-weighted factors, fairness tests that map to FCA requirements.

PM
Pricing managers evaluating modern tooling

You need to know what is production-ready and what is a research prototype. Each library here has actuarial tests, a clear scope, and outputs a pricing team lead can explain to a committee.

AR
Academic researchers working on insurance pricing methods

We implement recent literature: Manna et al. (2025) on conformal prediction, BYM2 spatial models, variance-weighted non-conformity scores. Reproducible, documented, testable.

Ten tools for the problems that matter most

These are the libraries we think are genuinely differentiated. Each addresses a specific hard problem in UK pricing — regulatory compliance, causal inference, uncertainty quantification, smoothing — where no adequate open-source Python tooling existed before. The full portfolio of 34 libraries is below.

FCA Consumer Duty insurance-fairness Proxy discrimination auditing for insurance pricing models. Quantifies indirect discrimination from rating variables correlated with protected characteristics. FCA Consumer Duty documentation support built in. FCA Consumer Duty proxy discrimination bias metrics PRA SS1/23 insurance-governance PRA SS1/23-compliant model validation reports. Bootstrap Gini CI, Poisson A/E CI, double-lift charts, renewal cohort test. 9-section HTML/JSON output ready for model risk committees and the PRA. PRA SS1/23 model governance MRM insurance-causal Double machine learning for deconfounding rating factors. Standard GLM coefficients are biased wherever rating variables correlate with distribution channel or policyholder behaviour. DML fixes that bias without a structural model. causal inference DML deconfounding insurance-whittaker Whittaker-Henderson smoothing for experience rating tables. 1D, 2D, and Poisson variants with REML lambda selection and Bayesian credible intervals. Smooths age curves, NCD scales, and vehicle group relativities. Pure NumPy/SciPy. REML smoothing experience rating insurance-telematics End-to-end pipeline from raw 1Hz GPS/accelerometer data to GLM-compatible risk scores. HMM driving state classification (cautious/normal/aggressive), Bühlmann-Straub credibility aggregation to driver level, Poisson GLM integration. HMM telematics UBI insurance-conformal Distribution-free prediction intervals with finite-sample coverage guarantees. Variance-weighted non-conformity scores produce tighter intervals than the naive approach with identical coverage. Solvency II SCR bounds included. conformal prediction uncertainty Solvency II insurance-credibility Bühlmann-Straub credibility in Python with mixed-model equivalence checks. Practical for capping thin segments, stabilising NCD factors, and blending a new model with an incumbent rate. The actuarial solution to the thin data problem. Bühlmann-Straub thin data NCD insurance-frequency-severity Sarmanov copula joint frequency-severity modelling with GLM marginals. IFM estimation, analytical premium correction, Garrido conditional severity, dependence tests. Tests the independence assumption every pricing model makes. 80+ tests. Sarmanov copula joint modelling dependence insurance-gam EBM and Neural Additive Model for interpretable deep learning in insurance pricing. Shape functions per rating factor give the transparency of a GLM with the predictive power of a neural network. Outputs factor tables for pricing committee review. EBM NAM interpretable ML insurance-monitoring Model drift detection for insurance pricing - exposure-weighted PSI/CSI, actual-vs-expected ratios, Gini drift z-test. Sequential testing for anytime-valid champion/challenger A/B tests. PIT calibration monitoring and feature-interaction drift attribution. drift detection sequential testing A/E ratios
View all 34 libraries Which library do I need?

The complete pricing workflow, covered

All 34 libraries. Each solves one well-defined problem. Actuarial tests included. sklearn-compatible where it matters.

📉
Data
insurance-cv ins-synthetic ins-datasets
🧠
Model
ins-credibility bayesian-pricing ins-multilevel ins-spatial ins-trend ins-anam ins-dispersion ins-experience
🔍
Interpret
shap-relativities ins-interactions ins-causal
Validate
ins-governance ins-conformal ins-monitoring
Compliance
ins-fairness ins-causal-policy ins-governance
📈
Deploy
ins-optimise ins-causal ins-deploy
Show full portfolio (34 libraries)
Techniques
insurance-credibility Buhlmann-Straub credibility in Python, with mixed-model equivalence checks. Practical for capping thin segments, stabilising NCD factors, and blending a new model with an incumbent rate. Buhlmann-Straub Polars bayesian-pricing Hierarchical Bayesian models for thin-data pricing segments. Partial pooling across risk groups, with credibility factor output in a format that maps back to traditional actuarial review. hierarchical Bayes partial pooling insurance-interactions Tools for detecting, quantifying, and presenting interaction effects in insurance pricing models: the effects a main-effects-only GLM cannot see. interaction effects GLM diagnostics insurance-causal Causal inference methods for insurance pricing. Separating genuine risk signal from confounded association, relevant wherever rating factors are correlated with distribution channel or policyholder behaviour. causal inference deconfounding insurance-spatial Spatial territory ratemaking using BYM2 models. Geographically smoothed relativities that borrow strength across adjacent areas, particularly useful for postcode-level home and motor models with thin data. BYM2 spatial smoothing postcode insurance-multilevel Two-stage CatBoost + REML random effects for high-cardinality group factors like broker, scheme, or fleet. Credibility-weighted adjustments with ICC diagnostics. mixed effects CatBoost credibility insurance-distill GBM-to-GLM distillation. Fits a surrogate Poisson or Gamma GLM to CatBoost predictions and exports multiplicative factor tables that Radar or Emblem can consume directly. distillation CatBoost factor tables insurance-survival Survival models for insurance retention. Cure rate models, CLV, lapse tables, insurance exposure handling, MLflow wrapper. Wraps lifelines with insurance-specific gaps filled. lapse retention CLV insurance-causal-policy Synthetic difference-in-differences for causal rate change evaluation. Event study, HonestDiD sensitivity, FCA evidence pack. Did your rate change actually cause the movement you see? SDID causal inference rate change insurance-trend Loss cost trend analysis with structural break detection. Identifies regime changes in claims frequency and severity, producing annualised trend factors with confidence intervals for reserving and pricing review. trend analysis structural breaks loss cost insurance-gam Actuarial Neural Additive Model for interpretable deep learning in insurance pricing. Shape functions per rating factor give the transparency of a GLM with the predictive power of a neural network. neural additive model interpretable ML deep learning insurance-glm-tools Automated GLM factor level clustering for insurance pricing. R2VF algorithm collapses 500 vehicle makes or 350 occupation codes into pricing bands. Ridge ranking for nominals, fused lasso for fusion, unpenalised GLM refit. BIC lambda selection. Monotonicity enforcement. fused lasso categorical banding GLM insurance-thin-data Foundation model pricing for thin segments. TabPFN v2 and TabICLv2 backend abstraction with a unified sklearn-compatible API, automated GLM benchmark, PDP relativities in standard factor table format, CommitteeReport output. When a segment has 200 policies, prior-fitted networks outperform GLMs without hyperparameter search. 72 tests. TabPFN thin data foundation model
📊 Tail risk & distributions
insurance-quantile Actuarial tail risk quantile/expectile regression. QuantileGBM wrapping CatBoost MultiQuantile, per-risk TVaR, large loss loading, ILF tables, exceedance curves, isotonic crossing fix. quantile GBM TVaR tail risk insurance-distributional Distributional GBMs for insurance. TweedieGBM, GammaGBM, ZIPGBM, NegBinomialGBM. Smyth-Jørgensen double GLM for dispersion. Per-risk volatility scoring. Tweedie distributional volatility insurance-synthetic Vine copula synthetic portfolio generation with insurance-specific marginals. Exposure-aware Poisson, constraint enforcement, fidelity reporting with TSTR Gini gap. vine copula synthetic data fidelity insurance-datasets Synthetic UK motor insurance datasets with known data generating process. Useful for model validation benchmarks, library demos, and training exercises. synthetic data UK motor DGP insurance-distributional-glm GAMLSS for Python: model ALL distribution parameters as functions of covariates — mean, dispersion, shape, zero-inflation. Seven families, RS algorithm with backtracking. Pure NumPy/SciPy. GAMLSS distributional GLM NumPy/SciPy insurance-dispersion Double GLM for joint mean-dispersion modelling. Standard GLMs assign a single scalar phi to all observations — fleet brokers and personal lines get identical volatility assumptions. DGLM fits a second regression for phi so dispersion varies by risk segment. Alternating IRLS, REML correction, overdispersion LRT, actuarial factor tables. 79 tests. double GLM dispersion REML insurance-severity Composite severity regression with spliced body/tail distributions, covariate-dependent thresholds, ILF estimation, and TVaR. The body and tail obey different physics; this fits them separately while letting the threshold vary by covariate. 106 tests. spliced distributions ILF TVaR

Start here

If you are a pricing actuary visiting for the first time, these are the posts worth reading first. Picked for coverage, not for clicks.

Insurance Pricing in Python — 12-module training course

A guided path through the full pricing workflow — GLMs to GAMs, causal inference, fairness auditing, and conformal prediction — in 12 hands-on modules with real pricing notebooks. Free and open source on GitHub.

View the Course →

Practitioner articles on insurance pricing

Five Libraries, One Pipeline: End-to-End Motor Pricing in Python
A single freMTPL2 motor pipeline running through insurance-gam, insurance-conformal, insurance-monitoring, insurance-fairness, and insurance-governance. No other open-source ecosystem does all five.
Read article →
Open-Source Python Tools for Insurance Pricing: What's Actually Available in 2026
A definitive survey of open-source Python tools for insurance pricing in 2026. General-purpose ML libraries, specialist actuarial packages, the Burning Cost stack, and honest gaps. The post a pricing actuary bookmarks.
Read article →
Consumer Duty Fair Value Evidencing: A 12-Step Technical Checklist for Pricing Actuaries (2026)
EP25/2 (the FCA's evaluation of GIPP price-walking remedies) flags ongoing fair value supervision in motor and home. No single technical checklist exists for the pricing actuary's portion of the annual fair value assessment. Here is one.
Read article →
FCA Consumer Duty Pricing Fairness in Python
The FCA expects pricing teams to demonstrate their models don't proxy-discriminate under Consumer Duty. Most teams do this in Excel. Here is how to do it properly in Python, using insurance-fairness.
Read article →
Fairlearn vs insurance-fairness: Why Generic ML Fairness Tools Miss What the FCA Cares About
Fairlearn is excellent for classification fairness. It was not built for insurance pricing, the Equality Act 2010, or the FCA's specific concern: proxy discrimination in a multiplicative rating model. Here is what the difference means in practice.
Read article →
Double Machine Learning for Insurance Pricing: Benchmarks and Pitfalls
Where double machine learning beats naive regression for insurance pricing — and where it does not. Benchmarks on 100,000-policy synthetic UK motor data with known ground truth. DML via insurance-causal.
Read article →
Three-Layer Drift Detection: What PSI and A&E Ratios Miss
Three-layer drift detection: feature drift, segmented calibration, Gini test. Tells you whether to recalibrate or refit - beyond PSI and A/E ratios.
Read article →
From CatBoost to Radar in 50 Lines of Python
Python library distilling CatBoost GBMs into multiplicative GLM factor tables for Radar and Emblem. Open-source GBM-to-GLM distillation for UK pricing teams.
Read article →
Blending GLMs and GBMs for UK Pricing: Cross-Validated Weights, Not a Choice Between Them
How to combine GLM and GBM predictions for production pricing: cross-validated blend weights, PRA interpretability, and when blending actually helps. Once the blended model is validated, document it in [`insurance-governance`](/insurance-governance/) for SoP3/24 audit trail.
Read article →
All articles →
Recent articles
View all 529 articles →