double_lift_chart#
- superglm.double_lift_chart(
- y_obs,
- y_pred_model,
- y_pred_current,
- sample_weight=None,
- exposure=None,
- *,
- n_bins: int = 10,
- labels: tuple[str, str, str] = ('Actual', 'Model', 'Current'),
- ax: Axes | None = None,
CAS-style double lift chart (CAS RPM 2016 methodology).
Sorts by the ratio
y_pred_model / y_pred_current, bins into equal-exposure quantiles, and plots three indexed series: Actual, Model, and Current — each indexed to its own overall average.This is the standard actuarial double lift chart for comparing a new model against a current/baseline model on holdout data.
- Parameters:
- y_obsarray-like
Observed response values (frequency, severity, or loss ratio).
- y_pred_modelarray-like
New model predictions (holdout).
- y_pred_currentarray-like
Current/baseline/manual predictions (holdout).
- sample_weightarray-like or None
Observation weights, read as replication mass by this comparison.
- exposurearray-like or None
Exposure measure for rate models.
- n_binsint
Number of equal-exposure quantile bins.
- labelstuple of (str, str, str)
Display labels as
(Actual, Model, Current). Each element names the corresponding series in the plot legend and axis labels.- axmatplotlib Axes or None
If provided, plot onto this axes (
figurein result will be None).
- Returns:
- DoubleLiftChartResult
Contains a
binsDataFrame and an optionalfigure.
References
CAS RPM 2016, “Predictive Modeling — Lift and Double Lift Charts”, https://www.casact.org/sites/default/files/presentation/rpm_2016_presentations_pm-lm-4.pdf