25.7k stars · MIT · v0.53.0rc0 (2026-09-07)
Per-prediction feature attribution — which of tsfresh's 700 features the surviving model actually leans on, and whether that reason is embarrassing.
▶Repo detailsthe review · specs · pros & cons · install
What it is
The standard library for explaining machine-learning model predictions, assigning each input feature a contribution to each individual output. It works with the gradient-boosted trees and scikit-learn models you would realistically use.
Why it matters
ScalpingMate now has tsfresh generating 700+ features, Optuna searching parameter space aggressively, and arch's reality check to ask whether the winner is luck. What is missing is the question in between: why does the surviving model say buy? SHAP answers it per trade — and the answers are frequently humiliating in a useful way. If your edge turns out to rest on the hour-of-day feature, you have found a session effect, not a pattern; if it rests on a feature computed with future information, you have found a leak that would have cost you real money. For a target as specific as 2% a month, knowing which three features carry the signal is also how you stop retraining on the other 697.
- TreeExplainer on gradient-boosted models is exact and fast — this is a minutes-not-hours step on your data size.
- The standard summary and waterfall plots make an abstract question visual, which matters when you are not a statistician.
- MIT-licensed, so unlike backtesting.py (AGPL) or vectorbt (Commons Clause) it can sit inside a paid feature — "here is why the system took this trade" is a sellable screen.
- It explains the model, not the market. A feature the model leans on can still be pure noise the model has memorised; this narrows where to look, it does not confirm anything.
- KernelExplainer, the fallback for non-tree models, is slow enough to be impractical on long series. Stay on tree models or budget the time.
- The API surface is large and the older tutorials use a deprecated interface, so expect some confusion between examples and current docs.
6 #12) beside the Optuna trials.
A Python dependency in ScalpingMate's virtualenv, run after training and before QuantStats reporting.