sweep_bands
def sweep_bands(latent, y, *, k_grid=(4, 6, 8, 10, 12, 16), scale: int = 1000, n_boot: int = 100, seed: int = 7) -> list[dict]
from compileml.tune import sweep_bands
Sweep fixed-K band counts; measure what each ladder costs and keeps.
Per K: band-ordinal Gini and its retention of the continuous latent's Gini, the Gini gap ("money on the table"), the worst within-band AUC with its refinement verdict, the smallest band's volume, and any integer-edge collisions at the display scale (a K too fine for the scale to represent).
For *discovering* K instead of sweeping it, see semantic_bands and
governance_bands — they return the number of bands the data can
statistically defend.
Parameters#
| Name | Type | Default | Kind |
|---|---|---|---|
| latent | — | required | positional |
| y | — | required | positional |
| k_grid | — | (4, 6, 8, 10, 12, 16) | keyword-only |
| scale | int | 1000 | keyword-only |
| n_boot | int | 100 | keyword-only |
| seed | int | 7 | keyword-only |
Returns#
list[dict]
Example#
python
from compileml.tune import sweep_bands results = sweep_bands(latent, y_train)