monotone_quantile_bands
from compileml.bands import monotone_quantile_bands
Quantile bands with empirical bad rates and isotonic-smoothed semantics.
Fixed-K quantile edges by default. With allow_merge=True, adjacent
bands whose empirical bad rates invert by more than merge_eps are
merged until no material violation remains — trading band count for
guaranteed-monotone empirical semantics.
scale is the artifact's display scale; edges that would collide once
converted to integers there are dropped instead of emitted, so the result
can carry fewer bands than requested. That reduction is separate from
allow_merge, which only merges bad-rate inversions.
Parameters#
| Name | Type | Default | Kind |
|---|---|---|---|
| latent | — | required | positional |
| y | — | required | positional |
| n_bands | int | 10 | positional |
| allow_merge | bool | False | keyword-only |
| merge_eps | float | 0.005 | keyword-only |
| scale | int | 1000 | keyword-only |
Returns#
compileml.bands.builders.BandSpec
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 monotone_quantile_bands bands = monotone_quantile_bands(latent, y_train, n_bands=10)