Metadata-Version: 2.5
Name: superglm
Version: 0.35.0
Summary: Penalised GLMs for insurance pricing: group lasso, P-splines, Tweedie
Project-URL: Documentation, https://strudeldoodles.github.io/superglm/
Project-URL: Homepage, https://github.com/StrudelDoodleS/superglm
Project-URL: Issues, https://github.com/StrudelDoodleS/superglm/issues
Project-URL: Repository, https://github.com/StrudelDoodleS/superglm
Author: Max Hicks
License-Expression: MIT
License-File: LICENSE
Keywords: actuarial,generalized-additive-models,generalized-linear-models,insurance-pricing,splines
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.12
Requires-Dist: fastapi>=0.115
Requires-Dist: joblib>=1.6.0
Requires-Dist: matplotlib>=3.7
Requires-Dist: narwhals>=2.17.0
Requires-Dist: numba>=0.57
Requires-Dist: numpy>=1.24
Requires-Dist: openpyxl>=3.1
Requires-Dist: pandas>=2.0
Requires-Dist: scikit-learn>=1.3
Requires-Dist: scipy>=1.10
Requires-Dist: tabmat>=4.2.1
Requires-Dist: threadpoolctl>=3.1
Requires-Dist: uvicorn>=0.30
Provides-Extra: bench
Requires-Dist: glum>=3.4.1; extra == 'bench'
Requires-Dist: pyarrow>=17; extra == 'bench'
Requires-Dist: statsmodels>=0.14; extra == 'bench'
Provides-Extra: dev
Requires-Dist: playwright>=1.55; extra == 'dev'
Requires-Dist: polars>=1.42.1; extra == 'dev'
Requires-Dist: pre-commit; extra == 'dev'
Requires-Dist: psutil>=7.2; extra == 'dev'
Requires-Dist: pyarrow>=17; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest-split>=0.11.0; extra == 'dev'
Requires-Dist: pytest>=9.0; extra == 'dev'
Requires-Dist: pyyaml>=6.0; extra == 'dev'
Requires-Dist: ruff==0.16.3; extra == 'dev'
Requires-Dist: ty==0.0.72; extra == 'dev'
Provides-Extra: plotting
Requires-Dist: plotly>=5.24; extra == 'plotting'
Description-Content-Type: text/markdown

<p align="center">
  <img src="https://raw.githubusercontent.com/StrudelDoodleS/superglm/master/docs/images/logo.png" alt="SuperGLM" width="300">
</p>

[![CI](https://github.com/StrudelDoodleS/superglm/actions/workflows/ci.yml/badge.svg)](https://github.com/StrudelDoodleS/superglm/actions/workflows/ci.yml)
[![codecov](https://codecov.io/github/StrudelDoodleS/superglm/graph/badge.svg?token=2HO71TA2ZY)](https://codecov.io/github/StrudelDoodleS/superglm)
[![Python 3.12+](https://img.shields.io/badge/python-3.12%20%7C%203.13%20%7C%203.14-blue)](https://github.com/StrudelDoodleS/superglm/actions/workflows/ci.yml)

Penalised GLMs and GAM-style pricing models for insurance. SuperGLM combines
explicit feature specs, exact REML, large-`n` discrete REML, solver-backed
monotone splines, actuarial validation tooling, and deployable fitted
estimators for Poisson, Gamma, NB2, Tweedie, Binomial, Gaussian, and Gaussian
or Gamma location–scale models.

## Install

```bash
pip install superglm
```

Interactive Plotly charts are optional: `pip install "superglm[plotting]"`.
The browser model editor is included.

## Fit a pricing model

```python
from superglm import Categorical, Numeric, Spline, SuperGLM

features = {
    "DrivAge": Spline(kind="ps", k=14, knot_strategy="quantile_rows"),
    "VehAge": Spline(kind="cr", k=10, knot_strategy="quantile_rows"),
    "BonusMalus": Spline(kind="cr", k=12, knot_strategy="quantile_tempered"),
    "Area": Categorical(base="most_exposed"),
    "LogDensity": Numeric(),
}
model = SuperGLM(family="poisson", features=features)
model.fit_reml(train_df, y_train, sample_weight=exposure_train)
print(model.summary())
```

REML chooses the smoothness of every spline. Monotone and curvature
constraints are enforced inside the fit. `SuperLSS` fits location, scale and
shape parameters together for severity and distributional work.

## Documentation

- [Get started](https://strudeldoodles.github.io/superglm/get-started/index.html)
- [Tutorials](https://strudeldoodles.github.io/superglm/tutorials/index.html)
- [How-to guides](https://strudeldoodles.github.io/superglm/how-to/index.html)
- [Explanation](https://strudeldoodles.github.io/superglm/explanation/index.html)
- [API reference](https://strudeldoodles.github.io/superglm/api/index.html)
- [Governance](https://strudeldoodles.github.io/superglm/governance/index.html)

## Licence

MIT. Free for everyone, commercial use included.
