Examples · Bands

semantic_bands

Search-and-certify banding, including the honest case: pure noise produces exactly one band.

Code#

semantic_bands.py
from _setup import latent, y_train
 
from compileml.bands import semantic_bands
 
# The default certification is strict: a band is only accepted once the score
# has no rank-ordering power left inside it. On a score this strong, that
# condition is not met anywhere, and the search refuses to split at all.
strict = semantic_bands(latent, y_train, max_bands=10, min_band_size=300)
print("default certification :", len(strict.labels), "band(s) —", strict.labels)
 
# Relaxing how much within-band ordering is tolerated is the knob that turns
# a refusal into a ladder. It is a judgement about what a band is for, and
# the library makes you state it rather than picking for you.
relaxed = semantic_bands(
latent,
y_train,
max_bands=10,
min_band_size=300,
eps_auc_search=0.12,
eps_auc_cert=0.12,
)
print("relaxed certification :", len(relaxed.labels), "band(s) —", relaxed.labels)

Output#

Captured from an actual run against compileml 0.9.0 and the UCI credit panel. If this script stops working, the build fails.

captured in CIsemantic_bands.py
default certification : 1 band(s) — ['G01']
relaxed certification : 10 band(s) — ['G01', 'G02', 'G03', 'G04', 'G05', 'G06', 'G07', 'G08', 'G09', 'G10']

Notes#

  • A single band means the evidence does not support separating anyone. Suppressing that result would be the bug.

API reference: semantic_bands →