decide
def decide(artifact: dict, features: collections.abc.Sequence[float | None], *, top_k: int | None = None, explain: bool = True, include_contributions: bool = False) -> dict
from compileml import decide
Run the complete decision for one row and return the payload dict.
With explain=False this is the sub-millisecond score path: latent,
band, and calibrated PD only. With explain=True it adds the exact
integer attribution and reason blocks. Attribution is aggregated per
tree, so its cost is O(trees) and independent of feature count.
Parameters#
| Name | Type | Default | Kind |
|---|---|---|---|
| artifact | dict | required | positional |
| features | collections.abc.Sequence[float | None] | required | positional |
| top_k | int | None | None | keyword-only |
| explain | bool | True | keyword-only |
| include_contributions | bool | False | keyword-only |
Returns#
dict
Raises#
Read from the function body and the private helpers it calls, not inferred. A function that raises nothing has no section here.
Example#
python
from compileml.runtime import load_artifact, decide artifact = load_artifact("decision.json")decision = decide(artifact, row, explain=True)print(decision["band"], decision["pd"], decision["latent_int"])