compileml.tune

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#

NameTypeDefaultKind
latent—requiredpositional
y—requiredpositional
k_grid—(4, 6, 8, 10, 12, 16)keyword-only
scaleint1000keyword-only
n_bootint100keyword-only
seedint7keyword-only

Returns#

list[dict]

Example#

python
from compileml.tune import sweep_bands
 
results = sweep_bands(latent, y_train)

Worked example: sweep_bands →