lorenz_curve#

superglm.lorenz_curve(
y_obs,
y_pred,
sample_weight=None,
exposure=None,
*,
engine: str = 'matplotlib',
ax: Axes | None = None,
) → LorenzCurveResult#

Lorenz curve with Gini coefficient computation.

Parameters:
y_obsarray-like

Observed response values.

y_predarray-like

Predicted response values.

sample_weightarray-like or None

Observation weights.

exposurearray-like or None

Exposure measure. When provided, the Lorenz curve uses cumulative exposure share on the x-axis.

engine{“matplotlib”, “plotly”}

Plotting backend. "plotly" requires the optional plotly dependency.

axmatplotlib Axes or None

If provided, plot onto this axes. Only valid with engine="matplotlib".

Returns:
LorenzCurveResult

Contains curve DataFrame, gini_model, gini_perfect, gini_ratio, and an optional figure.