SHAP Values
Per-feature contributions to a machine-learning model's prediction. SHAP decomposes one prediction into how much each input feature pushed the output up or down. Used in the TrapStats 'Why this pick' panel.
SHAP (SHapley Additive exPlanations) is a method for explaining individual predictions from a machine-learning model. Where a model says "this dog has a 38% win probability," SHAP decomposes that single number into per-feature contributions: how much was added or subtracted by recent form, by trap bias, by trainer strike rate, etc.
SHAP values are based on Shapley values from cooperative game theory, originally derived to fairly allocate the "value" of a game outcome among players. SHAP adapts this to ML by treating each feature as a "player" contributing to a prediction.
Key properties:
- Additive: per-prediction SHAP values plus a base value sum to the model's output.
- Sign-aware: positive SHAP = feature pushed prediction up; negative = pushed it down.
- Magnitude-aware: a SHAP of 0.08 on
recency_weighted_formcontributed more to this pick than a SHAP of 0.02 ontrap_win_rate.
LightGBM SHAP: a single predict(X, pred_contrib=True) call returns per-row, per-feature contributions plus a base column. We use this in ml/models/denis_predictor.py:explain_top_factors.
TrapStats application: the "Why this pick" panel on each Denis pick shows the top 5 SHAP factors for that dog — labeled in plain English (e.g. "recent form ↑", "trap win bias ↑", "trainer strike rate ↓") with the contribution magnitude. That's the model's reasoning, exposed at single-pick granularity.
SHAP doesn't tell you whether the prediction is correct — only how the model arrived at it. Pair it with a sanity check (does the reasoning match the racecard?) and the calibration history (how often is this combination of features actually right?).