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#
| Name | Type | Default | Kind |
|---|---|---|---|
| decisions | list[dict] | required | positional |
| y | — | None | keyword-only |
| values | — | None | keyword-only |
| sort_metric | str | 'mean' | keyword-only |
| top_codes | int | 20 | keyword-only |
| point_size | int | 6 | keyword-only |
| alpha_good | float | 0.65 | keyword-only |
| alpha_bad | float | 0.75 | keyword-only |
| y_jitter | float | 0.34 | keyword-only |
| xj_base | float | 0.06 | keyword-only |
| xj_max | float | 0.18 | keyword-only |
| seed | int | 0 | keyword-only |
| colors | dict | None | None | keyword-only |
| colors_low | dict | None | None | keyword-only |
| color_by | str | 'auto' | keyword-only |
| value_color | bool | False | keyword-only |
| value_alpha | bool | False | keyword-only |
| alpha_range | tuple | (0.2, 0.9) | keyword-only |
| ax | — | None | keyword-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.