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#
| Name | Type | Default | Kind |
|---|---|---|---|
| latent | — | required | positional |
| y | — | required | positional |
| max_bands | int | 10 | positional |
| min_band_size | int | 300 | positional |
| delta_sep | float | 0.002 | keyword-only |
| eps_auc_search | float | 0.02 | keyword-only |
| eps_auc_cert | float | 0.01 | keyword-only |
| alpha | float | 0.05 | keyword-only |
| proto_min_size | int | 200 | keyword-only |
| split_passes | int | 2 | keyword-only |
| n_boot_cert | int | 300 | keyword-only |
| rng_seed | int | 7 | keyword-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