band_efficiency
from compileml.bands import band_efficiency
Quantify the discrimination cost of a band ladder.
Args:
latent: Continuous latents in [0, 1] (whitebox predictions, clipped).
y: Binary outcomes aligned with latent.
bands: A compiled artifact dict, a :class:`BandSpec`, or a sequence
of float band edges. Assignment always runs on the fixed-point
integer ladder — the deployed semantics.
scale: Display scale used when bands is not an artifact.
n_boot: Bootstrap resamples for the per-band AUC intervals.
Returns:
dict with continuous_gini, band_ordinal_gini, gini_gap
(the money on the table, in Gini points), gini_gap_pct, a
per_band table (n, bad_rate, within-band AUC + CI), and
worst_band — the band whose lower CI bound sits highest above
0.5, i.e. the strongest refinement candidate.
Parameters#
| Name | Type | Default | Kind |
|---|---|---|---|
| latent | — | required | positional |
| y | — | required | positional |
| bands | — | required | positional |
| scale | int | 1000 | keyword-only |
| n_boot | int | 200 | keyword-only |
| alpha | float | 0.05 | keyword-only |
| seed | int | 7 | keyword-only |
Returns#
dict
Raises#
- ValueError
Read from the function body and the private helpers it calls, not inferred. A function that raises nothing has no section here.
Example#
from compileml.bands import band_efficiency report = band_efficiency(latent, y_train, bands)print(report["verdict"]) # refinable | exhausted | inconclusive