Pure-Python ratemaking for P&C insurance — end to end.
Project description
pyratemaking 📊
Pure-Python ratemaking for P&C insurance — end to end.
pyratemaking is the Python implementation of the Werner & Modlin ratemaking workflow: rate level indication, on-leveling, trending, development, classification analysis, large loss procedures, and rate implementation. Built for P&C actuaries who want a reproducible pipeline from raw policies and claims to a defensible rate filing.
Why
Python has GLM libraries. It has chain-ladder libraries. It does not have an end-to-end ratemaking workflow. pyratemaking is that workflow.
Install
pip install pyratemaking # core
pip install pyratemaking[full] # with full ecosystem (whsmooth, actudist, etc.)
Quickstart
from pyratemaking import RatePlan
from pyratemaking.datasets import french_motor
policies, claims = french_motor.load()
plan = RatePlan(
policies=policies,
claims=claims,
exposure_col="exposure",
loss_col="claim_amount",
ay_col="policy_ay",
)
indication = plan.indicate(method="loss_ratio", target_lr=0.65)
print(indication.summary())
plan.classify(
rating_vars=["driver_age", "veh_power", "region"],
backend="glum",
family="tweedie",
power=1.5,
)
plan.implement(cap=1.15, floor=0.85)
plan.report.filing("filing_2026.html")
Werner & Modlin coverage
| Chapter | Topic | Module |
|---|---|---|
| 5 | On-leveling | pyratemaking.onleveling |
| 6 | Loss development | pyratemaking.development |
| 7 | Trending | pyratemaking.trending |
| 8 | Overall rate level indication | pyratemaking.core.indication |
| 9-10 | Classification ratemaking | pyratemaking.core.classification |
| 11 | Increased limits / large loss | pyratemaking.large_loss |
| 12 | GLMs | pyratemaking.glm |
| 14 | Implementation | pyratemaking.core.implementation |
Ecosystem
Part of a 6-library actuarial Python suite:
actudist— severity and frequency distributionsburncost— burning cost analysisactuarcredibility— credibility methodswhsmooth— Whittaker-Henderson smoothingpyratemaking— ratemaking workflow (this library)pyinsurancerating— rating engine (coming)
Roadmap
Future releases will add Bayesian hierarchical credibility, deep-learning rating models (LocalGLMnet, CANN), premium calculation principles, fairness auditing, a CLI tool, and a Streamlit exploration dashboard. See milestones.
References
- Werner, G. & Modlin, C. (2016). Basic Ratemaking (5th ed.). Casualty Actuarial Society.
- Goldburd, M., Khare, A., Tevet, D. & Guller, D. (2020). Generalized Linear Models for Insurance Rating (2nd ed.). CAS Monograph 5.
- Friedland, J. (2013). Fundamentals of General Insurance Actuarial Analysis. Society of Actuaries.
- Mack, T. (1993). "Distribution-free Calculation of the Standard Error of Chain Ladder Reserve Estimates." ASTIN Bulletin, 23(2), 213-225.
License
MIT © Isaac López
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyratemaking-0.1.1.tar.gz.
File metadata
- Download URL: pyratemaking-0.1.1.tar.gz
- Upload date:
- Size: 72.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e06dca49716abb39c38398f5bda96e83634c23fdcfa2a0e92e076c0dc1f4520
|
|
| MD5 |
508cb1f579c79a583008e7e4dae03e46
|
|
| BLAKE2b-256 |
3af426919ec50724b8c763a91081fe3b1f6e166badae09db7a237092f722af6e
|
File details
Details for the file pyratemaking-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pyratemaking-0.1.1-py3-none-any.whl
- Upload date:
- Size: 77.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67a62b1e7de6d8ce7eda28c3dc2a661607e746d61970d208968adabc15c0bdab
|
|
| MD5 |
87707a5d1d06be4ace2459a9e34baa04
|
|
| BLAKE2b-256 |
7078d04661bc7bd20339442c3020982171db29c8b4a08dce183dcc325cc7dd61
|