compileml.bands

semantic_bands

def semantic_bands(latent, y, max_bands: int = 10, min_band_size: int = 300, *, delta_sep: float = 0.002, eps_auc_search: float = 0.02, eps_auc_cert: float = 0.01, alpha: float = 0.05, proto_min_size: int = 200, split_passes: int = 2, n_boot_cert: int = 300, rng_seed: int = 7) -> compileml.bands.builders.BandSpec

from compileml.bands import semantic_bands

Discover the maximum number of statistically separable risk bands.

A banding is accepted when every band has n >= min_band_size, adjacent Jeffreys PD intervals are separated by at least delta_sep, and no band retains internal rank-ordering power above 0.5 + eps_auc (the score is "used up" within each band). Search runs on cheap point estimates; the final banding is certified once with bootstrap AUC intervals.

Parameters#

NameTypeDefaultKind
latent—requiredpositional
y—requiredpositional
max_bandsint10positional
min_band_sizeint300positional
delta_sepfloat0.002keyword-only
eps_auc_searchfloat0.02keyword-only
eps_auc_certfloat0.01keyword-only
alphafloat0.05keyword-only
proto_min_sizeint200keyword-only
split_passesint2keyword-only
n_boot_certint300keyword-only
rng_seedint7keyword-only

Returns#

compileml.bands.builders.BandSpec

Raises#

  • RuntimeError
  • 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 semantic_bands
 
bands = semantic_bands(latent, y_train) # returns a single band when the signal is noise

Worked example: semantic_bands →