ratingmodels
Manual and experience rating, credibility blending, and rate indication with an audit trail.
Overview
ratingmodels implements the pieces of a pricing exercise as small,
inspectable objects: an experience rate with pooling and trend, a manual rate
with factor application, credibility blending, a rate indication that
decomposes exactly into its drivers, renewal capping, and rate build-up with
a line-by-line audit trail.
It also covers the modeling side of pricing — GLM relativities, a frequency–severity model with prediction intervals, on-leveling, dislocation, and scenario evaluation — all against tidy inputs.
Installation
pip install ratingmodels
Requires Python 3.10 or newer.
Quick start
import ratingmodels as rm
# experience side: pool large claims, trend, and target loss ratio
capped, excess = rm.pool_claims([612_000, 340_000, 128_000, 96_500],
pooling_point=250_000)
exp = rm.ExperienceRate(
incurred_claims=4_200_000, exposure=9_600,
trend_annual=0.075, trend_years=1.5,
pooled_excess=excess, pooling_charge=38.00,
target_loss_ratio=0.85,
)
# manual side, then blend by limited-fluctuation credibility
man = rm.ManualRate(base_loss_cost=480,
factors={"area": 1.05, "industry": 0.97, "tier": 1.10},
target_loss_ratio=0.85)
z = rm.limited_fluctuation_credibility(n=9_600, n_full=12_000)
ind = rm.RateIndication(
experience_loss_cost=exp.loss_cost(), manual_loss_cost=man.loss_cost(),
credibility=z, current_rate=520, target_loss_ratio=0.85,
trend_total_factor=exp.trend_factor(),
benefit_factor=1.00, demographic_factor=1.01,
)
print(f"indicated rate : {ind.indicated_rate():.2f}")
print(f"indicated change : {ind.indicated_rate_change():+.2%}")
# why did the rate move, and what does a 5% cap do to it?
print(ind.rate_change_decomposition().to_frame())
action = rm.renew(current_rate=520, indicated_rate=ind.indicated_rate(), cap=0.05)
print(f"proposed (capped): {action.proposed_rate:.2f} ({action.proposed_change:+.2%})")
What's inside
- Experience rating —
ExperienceRatewith pooling, trend, and target-loss-ratio gross-up. - Manual rating —
ManualRatewith multiplicative factor application. - Credibility and blending — limited-fluctuation credibility and experience/manual blends.
- Indication —
RateIndicationwith an exact rate-change decomposition; renewal capping viarenew. - Rate build-up — layered build-up with a line-by-line audit trail; base rates and retention by the off-balance method.
- Modeling —
GLMRelativities, a frequency–severity model with prediction intervals, on-leveling, dislocation, scenarios, and evaluation utilities.
The full API reference and end-to-end worked examples live at openactuarial.org/ratingmodels.html.
The OpenActuarial ecosystem
ratingmodels is one of seven packages that share conventions — tidy tables,
explicit distribution parameterizations, reproducible random-number handling —
and compose across package seams:
| Package | Role |
|---|---|
| actuarialpy | Calculation primitives the workflow packages build on |
| experiencestudies | Experience reporting, actual-vs-expected, claimant and concentration analysis |
| projectionmodels | Claim, premium, and expense projection over a renewal horizon |
| ratingmodels | Manual and experience rating, credibility, indication, GLM relativities |
| lossmodels | Severity and frequency fitting, aggregate loss distributions |
| extremeloss | Extreme-value tails: POT/GPD, GEV, return levels, splicing |
| risksim | Portfolio Monte Carlo, dependence, reinsurance contracts, risk measures |
Install everything at once with pip install openactuarial.
Development
git clone https://github.com/OpenActuarial/ratingmodels
cd ratingmodels
python -m pip install -e ".[dev]"
pytest
ruff check src tests
CI runs the same gate on Python 3.10–3.14 across Linux and Windows.
Versioning and stability
All ecosystem packages are pre-1.0: minor releases may change APIs, and every release is documented in CHANGELOG.md. Current per-package API stability is tracked at openactuarial.org/stability.html.
License
MIT — see LICENSE.
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 ratingmodels-0.7.2.tar.gz.
File metadata
- Download URL: ratingmodels-0.7.2.tar.gz
- Upload date:
- Size: 124.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9691fdacb59e335e4d1a1e9d2f628b804b649b6a512984fbd59d84c76a9b5573
|
|
| MD5 |
de321f315a5e5519ef68959cc5fe286c
|
|
| BLAKE2b-256 |
3b6db1ed32b74ad86bbbbee65049d17f3c23f9e22c6254fb18268772374764e8
|
Provenance
The following attestation bundles were made for ratingmodels-0.7.2.tar.gz:
Publisher:
release.yml on OpenActuarial/ratingmodels
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ratingmodels-0.7.2.tar.gz -
Subject digest:
9691fdacb59e335e4d1a1e9d2f628b804b649b6a512984fbd59d84c76a9b5573 - Sigstore transparency entry: 2145560246
- Sigstore integration time:
-
Permalink:
OpenActuarial/ratingmodels@1db5a12632bb289063ce9915619e81b96bc8cfb3 -
Branch / Tag:
refs/tags/v0.7.2 - Owner: https://github.com/OpenActuarial
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1db5a12632bb289063ce9915619e81b96bc8cfb3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ratingmodels-0.7.2-py3-none-any.whl.
File metadata
- Download URL: ratingmodels-0.7.2-py3-none-any.whl
- Upload date:
- Size: 82.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
727cf14c244545766659376fc68b1c0e828079cf36c1e93daf4656fb084a2fff
|
|
| MD5 |
5c10857d5ea7c76c12dc55323109bf41
|
|
| BLAKE2b-256 |
96fcfb724eca0c3ead9ccb90fedda49ae71cb76209c5e20472138df4f946655f
|
Provenance
The following attestation bundles were made for ratingmodels-0.7.2-py3-none-any.whl:
Publisher:
release.yml on OpenActuarial/ratingmodels
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ratingmodels-0.7.2-py3-none-any.whl -
Subject digest:
727cf14c244545766659376fc68b1c0e828079cf36c1e93daf4656fb084a2fff - Sigstore transparency entry: 2145560258
- Sigstore integration time:
-
Permalink:
OpenActuarial/ratingmodels@1db5a12632bb289063ce9915619e81b96bc8cfb3 -
Branch / Tag:
refs/tags/v0.7.2 - Owner: https://github.com/OpenActuarial
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1db5a12632bb289063ce9915619e81b96bc8cfb3 -
Trigger Event:
push
-
Statement type: