compileml.bands

monotone_quantile_bands

def monotone_quantile_bands(latent, y, n_bands: int = 10, *, allow_merge: bool = False, merge_eps: float = 0.005, scale: int = 1000) -> compileml.bands.builders.BandSpec

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#

NameTypeDefaultKind
latent—requiredpositional
y—requiredpositional
n_bandsint10positional
allow_mergeboolFalsekeyword-only
merge_epsfloat0.005keyword-only
scaleint1000keyword-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#

python
from compileml.bands import monotone_quantile_bands
 
bands = monotone_quantile_bands(latent, y_train, n_bands=10)

Worked example: quantile_bands · monotone_quantile_bands →