recalibrate_artifact
from compileml.artifact import recalibrate_artifact
Refit calibration on fresh outcomes; model and band edges unchanged.
Args:
artifact: An existing decision artifact.
latent: Fresh latent scores in [0, 1] (clipped), e.g. the artifact's
own latent_micro / micro_scale on the new sample.
y: Fresh binary outcomes aligned with latent.
mode: Calibration mode for the new table; defaults to the old one.
prior_strength: Optional shrinkage weight pulling per-band empirical
bad rates toward a prior for the band metadata refresh — small
bands get stabilized rates.
prior_pi0: The prior rate (defaults to the global bad rate).
Returns:
A new artifact dict with updated calibration, refreshed band
bad-rate metadata, metadata.recalibration.recalibrated_from set
to the old hash, and a new artifact_hash.
Parameters#
| Name | Type | Default | Kind |
|---|---|---|---|
| artifact | dict | required | positional |
| latent | — | required | positional |
| y | — | required | positional |
| mode | str | None | None | keyword-only |
| prior_strength | float | 0.0 | keyword-only |
| prior_pi0 | float | None | None | keyword-only |
Returns#
dict
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.artifact import recalibrate_artifact fresh = recalibrate_artifact(artifact, latent_new, y_new) # bands and model unchanged