compileml.bands

band_efficiency

def band_efficiency(latent, y, bands, *, scale: int = 1000, n_boot: int = 200, alpha: float = 0.05, seed: int = 7) -> dict

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#

NameTypeDefaultKind
latent—requiredpositional
y—requiredpositional
bands—requiredpositional
scaleint1000keyword-only
n_bootint200keyword-only
alphafloat0.05keyword-only
seedint7keyword-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#

python
from compileml.bands import band_efficiency
 
report = band_efficiency(latent, y_train, bands)
print(report["verdict"]) # refinable | exhausted | inconclusive

Worked example: band_efficiency →