Examples · Deciding
decide
The score-only path versus the explained payload, and how missing values are handled under each policy.
Code#
decide.py
from _setup import artifact, row from compileml.runtime import decide fast = decide(artifact, row, explain=False)print("score only :", {k: fast[k] for k in ("band", "pd", "latent_int")}) full = decide(artifact, row, explain=True, top_k=3)print()print("adverse reasons, largest first:")for reason in full["reasons_negative"]: print(f" {reason['impact_int']:>5} {reason['code']:<22} {reason['message']}") # A missing value is imputed from features.baseline under this policy.patched = list(row)patched[0] = Noneprint()print("with LIMIT_BAL missing:", decide(artifact, patched, explain=False)["band"])print("with LIMIT_BAL present:", fast["band"])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 CIdecide.py
score only : {'band': 'G09', 'pd': 0.378049, 'latent_int': 341} adverse reasons, largest first: 117 REPAYMENT_STATUS_M1 Repayment was behind schedule 1 month(s) before assessment. 84 REPAYMENT_STATUS_M2 Repayment was behind schedule 2 month(s) before assessment. 10 AMOUNT_PAID_M4 The amount paid 4 month(s) before assessment was small. with LIMIT_BAL missing: G09with LIMIT_BAL present: G09Notes#
- explain=False is the sub-millisecond path. explain=True adds O(n_features²) traversals.
- reject