compileml.viz

decision_drivers

def decision_drivers(decisions: list[dict], *, y=None, values=None, sort_metric: str = 'mean', top_codes: int = 20, point_size: int = 6, alpha_good: float = 0.65, alpha_bad: float = 0.75, y_jitter: float = 0.34, xj_base: float = 0.06, xj_max: float = 0.18, seed: int = 0, colors: dict | None = None, colors_low: dict | None = None, color_by: str = 'auto', value_color: bool = False, value_alpha: bool = False, alpha_range: tuple = (0.2, 0.9), ax=None)

from compileml.viz import decision_drivers

Global decision drivers (deterministic SHAP-style beeswarm).

Original design, payload-driven: one point per (decision, top-k reason), labeled by reason code, biggest drivers on top. color_by: "auto" (outcome when y given, else impact direction), "impact", or "outcome". value_color / value_alpha encode per-point feature values (pass values as one {feature: value} dict per decision).

Returns: (figure, axes)

Parameters#

NameTypeDefaultKind
decisionslist[dict]requiredpositional
y—Nonekeyword-only
values—Nonekeyword-only
sort_metricstr'mean'keyword-only
top_codesint20keyword-only
point_sizeint6keyword-only
alpha_goodfloat0.65keyword-only
alpha_badfloat0.75keyword-only
y_jitterfloat0.34keyword-only
xj_basefloat0.06keyword-only
xj_maxfloat0.18keyword-only
seedint0keyword-only
colorsdict | NoneNonekeyword-only
colors_lowdict | NoneNonekeyword-only
color_bystr'auto'keyword-only
value_colorboolFalsekeyword-only
value_alphaboolFalsekeyword-only
alpha_rangetuple(0.2, 0.9)keyword-only
ax—Nonekeyword-only

Raises#

  • ValueError

Read from the function body and the private helpers it calls, not inferred. A function that raises nothing has no section here.

Worked example: decision_drivers →