what_if
Scope: compute · Signature: what_if(experiment_id: str, row: dict[str, Any], base: dict[str, Any] | None = None, calibrated: bool = True, explain: bool = False, active_class: bool | int | float | str | None = None) -> Any
Use to score ONE row and see why: "what would the model say if ...".
base={"row_index": n} or {"key": {"": value}} selects a dataset
row; row supplies changes (row={} scores it unchanged). Without base,
row is the whole case and omitted columns become null. row_basis reports
the source row, replacements, nulled columns and columns the model ignores.
Supervised: prediction, SHAP, archetype, neighbours and decision-layer
revision. active_class selects the original serving class label to explain,
not an encoded profile key or column index; omitted uses the primary class.
explain=true adds ICE, LOCO and counterfactuals (slower).
Anomaly/clustering: score/flag or cluster with reason codes; active_class
and explain=true are unsupported. DBSCAN/HDBSCAN/agglomerative cannot place
new rows (422). For batches use score_batch; for existing predictions use
query_sql. Needs a compute token.
Powered by: mli per-case justification (mli/docs/guides/decision-support.md).