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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
tags:
|
| 6 |
+
- insurance
|
| 7 |
+
- pricing
|
| 8 |
+
- glm
|
| 9 |
+
- ebm
|
| 10 |
+
- explainable-ai
|
| 11 |
+
- uk-insurance
|
| 12 |
+
- tabular-regression
|
| 13 |
+
- actuarial
|
| 14 |
+
- bytical
|
| 15 |
+
pipeline_tag: tabular-regression
|
| 16 |
+
datasets:
|
| 17 |
+
- piyushptiwari/insureos-training-data
|
| 18 |
+
model-index:
|
| 19 |
+
- name: InsurePricing
|
| 20 |
+
results:
|
| 21 |
+
- task:
|
| 22 |
+
type: tabular-regression
|
| 23 |
+
name: Insurance Premium Pricing
|
| 24 |
+
metrics:
|
| 25 |
+
- type: mae
|
| 26 |
+
value: 11132
|
| 27 |
+
name: MAE — EBM (£)
|
| 28 |
+
- type: mae
|
| 29 |
+
value: 12245
|
| 30 |
+
name: MAE — GLM (£)
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
# InsurePricing — Insurance Premium Pricing Models
|
| 34 |
+
|
| 35 |
+
**Created by [Bytical AI](https://bytical.ai)** — AI agents that run insurance operations.
|
| 36 |
+
|
| 37 |
+
## Model Description
|
| 38 |
+
|
| 39 |
+
InsurePricing provides two complementary pricing models for UK motor insurance premiums, designed for actuarial and underwriting workflows:
|
| 40 |
+
|
| 41 |
+
1. **Tweedie GLM** — Generalized Linear Model with Tweedie distribution (power=1.5), the industry-standard approach for insurance pricing
|
| 42 |
+
2. **Explainable Boosting Machine (EBM)** — Interpretable glass-box model from Microsoft Research (InterpretML) that provides per-feature explanations
|
| 43 |
+
|
| 44 |
+
### Model Comparison
|
| 45 |
+
|
| 46 |
+
| Model | MAE (£) | RMSE (£) | MAPE (%) | Interpretable |
|
| 47 |
+
|-------|---------|----------|----------|---------------|
|
| 48 |
+
| **EBM** | **£11,132** | £14,787 | 177.6% | Yes — per-feature shape functions |
|
| 49 |
+
| **Tweedie GLM** | £12,245 | £17,615 | 198.8% | Yes — coefficients |
|
| 50 |
+
|
| 51 |
+
### Risk Factors (17 Features)
|
| 52 |
+
|
| 53 |
+
| Feature | Type | Description |
|
| 54 |
+
|---------|------|-------------|
|
| 55 |
+
| driver_age | Numeric | Age of primary driver |
|
| 56 |
+
| years_driving | Numeric | Years of driving experience |
|
| 57 |
+
| years_ncd | Numeric | No-claims discount years |
|
| 58 |
+
| vehicle_year | Numeric | Year of vehicle manufacture |
|
| 59 |
+
| vehicle_value | Numeric | Vehicle market value (£) |
|
| 60 |
+
| annual_mileage | Numeric | Estimated annual miles |
|
| 61 |
+
| voluntary_excess | Numeric | Voluntary excess amount (£) |
|
| 62 |
+
| compulsory_excess | Numeric | Compulsory excess amount (£) |
|
| 63 |
+
| previous_claims_3y | Numeric | Claims in last 3 years |
|
| 64 |
+
| policy_age_days | Numeric | Days since policy inception |
|
| 65 |
+
| vehicle_age | Derived | Current year minus vehicle_year |
|
| 66 |
+
| driver_experience_ratio | Derived | years_driving / driver_age |
|
| 67 |
+
| ncd_ratio | Derived | years_ncd / years_driving |
|
| 68 |
+
| vehicle_make_enc | Encoded | Vehicle manufacturer |
|
| 69 |
+
| fuel_type_enc | Encoded | Fuel type |
|
| 70 |
+
| occupation_enc | Encoded | Driver occupation |
|
| 71 |
+
| region_enc | Encoded | UK region |
|
| 72 |
+
|
| 73 |
+
### EBM Top Feature Importances
|
| 74 |
+
|
| 75 |
+
| Feature | Importance |
|
| 76 |
+
|---------|-----------|
|
| 77 |
+
| previous_claims_3y | 3,259 |
|
| 78 |
+
| policy_age_days | 2,684 |
|
| 79 |
+
| previous_claims_3y × policy_age_days | 1,608 |
|
| 80 |
+
| region_enc | 221 |
|
| 81 |
+
| vehicle_make_enc | 173 |
|
| 82 |
+
| annual_mileage | 172 |
|
| 83 |
+
| compulsory_excess | 165 |
|
| 84 |
+
| voluntary_excess | 163 |
|
| 85 |
+
| ncd_ratio | 153 |
|
| 86 |
+
|
| 87 |
+
### Training Data
|
| 88 |
+
|
| 89 |
+
- 25,000 synthetic UK motor insurance policies (20K train / 5K test)
|
| 90 |
+
- Features include driver demographics, vehicle attributes, claim history, and policy details
|
| 91 |
+
|
| 92 |
+
### Files
|
| 93 |
+
|
| 94 |
+
| File | Description |
|
| 95 |
+
|------|-------------|
|
| 96 |
+
| `tweedie_glm.pkl` | Scikit-learn Tweedie GLM pipeline |
|
| 97 |
+
| `pricing_ebm.pkl` | InterpretML EBM model |
|
| 98 |
+
| `label_encoders.pkl` | Fitted label encoders for categorical features |
|
| 99 |
+
| `training_results.json` | Full training metrics and feature coefficients |
|
| 100 |
+
|
| 101 |
+
## How to Use
|
| 102 |
+
|
| 103 |
+
```python
|
| 104 |
+
import pickle
|
| 105 |
+
import numpy as np
|
| 106 |
+
|
| 107 |
+
# Load EBM model
|
| 108 |
+
with open("pricing_ebm.pkl", "rb") as f:
|
| 109 |
+
ebm = pickle.load(f)
|
| 110 |
+
with open("label_encoders.pkl", "rb") as f:
|
| 111 |
+
encoders = pickle.load(f)
|
| 112 |
+
|
| 113 |
+
# Example: price a motor policy
|
| 114 |
+
features = np.array([[
|
| 115 |
+
30, # driver_age
|
| 116 |
+
8, # years_driving
|
| 117 |
+
4, # years_ncd
|
| 118 |
+
2022, # vehicle_year
|
| 119 |
+
20000, # vehicle_value
|
| 120 |
+
10000, # annual_mileage
|
| 121 |
+
200, # voluntary_excess
|
| 122 |
+
100, # compulsory_excess
|
| 123 |
+
0, # previous_claims_3y
|
| 124 |
+
180, # policy_age_days
|
| 125 |
+
4, # vehicle_age
|
| 126 |
+
0.267, # driver_experience_ratio
|
| 127 |
+
0.5, # ncd_ratio
|
| 128 |
+
3, # vehicle_make_enc
|
| 129 |
+
1, # fuel_type_enc
|
| 130 |
+
5, # occupation_enc
|
| 131 |
+
7 # region_enc
|
| 132 |
+
]])
|
| 133 |
+
|
| 134 |
+
premium = ebm.predict(features)[0]
|
| 135 |
+
print(f"Predicted premium: £{premium:,.2f}")
|
| 136 |
+
|
| 137 |
+
# Get per-feature explanations (EBM glass-box)
|
| 138 |
+
explanations = ebm.explain_local(features)
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
## Part of the INSUREOS Model Suite
|
| 142 |
+
|
| 143 |
+
This model is part of the **INSUREOS** — a complete AI/ML suite for insurance operations built by Bytical AI:
|
| 144 |
+
|
| 145 |
+
| Model | Task | Metric |
|
| 146 |
+
|-------|------|--------|
|
| 147 |
+
| [InsureLLM-4B](https://huggingface.co/piyushptiwari/InsureLLM-4B) | Insurance domain LLM | ROUGE-1: 0.384 |
|
| 148 |
+
| [InsureDocClassifier](https://huggingface.co/piyushptiwari/InsureDocClassifier) | 12-class document classification | F1: 1.0 |
|
| 149 |
+
| [InsureNER](https://huggingface.co/piyushptiwari/InsureNER) | 13-entity Named Entity Recognition | F1: 1.0 |
|
| 150 |
+
| [InsureFraudNet](https://huggingface.co/piyushptiwari/InsureFraudNet) | Fraud detection (Motor/Property/Liability) | AUC-ROC: 1.0 |
|
| 151 |
+
| **InsurePricing** (this model) | Insurance pricing (GLM + EBM) | MAE: £11,132 |
|
| 152 |
+
|
| 153 |
+
## Citation
|
| 154 |
+
|
| 155 |
+
```bibtex
|
| 156 |
+
@misc{bytical2026insurepricing,
|
| 157 |
+
title={InsurePricing: Explainable Insurance Premium Pricing Models},
|
| 158 |
+
author={Bytical AI},
|
| 159 |
+
year={2026},
|
| 160 |
+
url={https://huggingface.co/piyushptiwari/InsurePricing}
|
| 161 |
+
}
|
| 162 |
+
```
|
| 163 |
+
|
| 164 |
+
## About Bytical AI
|
| 165 |
+
|
| 166 |
+
[Bytical](https://bytical.ai) builds AI agents that run insurance operations — claims automation, underwriting intelligence, digital sales, and core system modernization for insurers across the UK and Europe. Microsoft AI Partner | NVIDIA | Salesforce.
|
label_encoders.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1f268abb3ea8f23ea194a4b0f432388913854b95624d3f897c4d056254b84d03
|
| 3 |
+
size 985
|
pricing_ebm.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:158a6ccb771326298f57523477003ce2f82e4027f1e92c20a4a5ed505d52202d
|
| 3 |
+
size 1554602
|
training_results.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"glm": {
|
| 3 |
+
"model": "TweedieGLM",
|
| 4 |
+
"tweedie_power": 1.5,
|
| 5 |
+
"mae": 12244.958454220796,
|
| 6 |
+
"rmse": 17615.02268631013,
|
| 7 |
+
"mape_pct": 198.8474585306464,
|
| 8 |
+
"coefficients": {
|
| 9 |
+
"driver_age": 0.0,
|
| 10 |
+
"years_driving": 0.0,
|
| 11 |
+
"years_ncd": 0.0,
|
| 12 |
+
"vehicle_year": 0.0,
|
| 13 |
+
"vehicle_value": 0.0,
|
| 14 |
+
"annual_mileage": 0.0,
|
| 15 |
+
"voluntary_excess": 0.0,
|
| 16 |
+
"compulsory_excess": 0.0,
|
| 17 |
+
"previous_claims_3y": 0.0,
|
| 18 |
+
"policy_age_days": 0.0,
|
| 19 |
+
"vehicle_age": 0.0,
|
| 20 |
+
"driver_experience_ratio": 0.0,
|
| 21 |
+
"ncd_ratio": 0.0,
|
| 22 |
+
"vehicle_make_enc": 0.0,
|
| 23 |
+
"fuel_type_enc": 0.0,
|
| 24 |
+
"occupation_enc": 0.0,
|
| 25 |
+
"region_enc": 0.0
|
| 26 |
+
},
|
| 27 |
+
"intercept": 9.967596757593236,
|
| 28 |
+
"n_train": 20000,
|
| 29 |
+
"n_test": 5000
|
| 30 |
+
},
|
| 31 |
+
"ebm": {
|
| 32 |
+
"model": "EBM",
|
| 33 |
+
"mae": 11131.778297959956,
|
| 34 |
+
"rmse": 14787.148537325793,
|
| 35 |
+
"mape_pct": 177.58336694602855,
|
| 36 |
+
"n_train": 20000,
|
| 37 |
+
"n_test": 5000,
|
| 38 |
+
"top_features": {
|
| 39 |
+
"previous_claims_3y": 3259.1140028713794,
|
| 40 |
+
"policy_age_days": 2683.871584881652,
|
| 41 |
+
"previous_claims_3y & policy_age_days": 1608.1250699587606,
|
| 42 |
+
"region_enc": 221.31391899112393,
|
| 43 |
+
"vehicle_make_enc": 173.4298978553976,
|
| 44 |
+
"voluntary_excess & previous_claims_3y": 172.51716007254487,
|
| 45 |
+
"annual_mileage": 171.50784229318242,
|
| 46 |
+
"compulsory_excess": 165.02085743907992,
|
| 47 |
+
"voluntary_excess": 163.32366251884218,
|
| 48 |
+
"ncd_ratio": 152.51296273306403
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
}
|
tweedie_glm.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a8aaf2b3334e26fb287ebf284e757af0d2bc90f409cb5cc62f7b4426893f0c7c
|
| 3 |
+
size 1312
|