rules/shap/plot-raw-shap-values.md
shap.plots.waterfall() and shap.plots.beeswarm() require a shap.Explanation object and raise TypeError when given the raw NumPy array returned by explainer.shap_values(X).
diff
| 1 | -shap.plots.waterfall(explainer.shap_values(X_val)[0]) |
| 2 | +explanation = explainer(X_val) |
| 3 | +shap.plots.waterfall(explanation[0]) |
What the rule reports
Calls to waterfall(...), waterfall_plot(...), or beeswarm(...) that pass explainer.shap_values(...) (or a subscript of it) directly.
How to fix it
Call the explainer (explanation = explainer(X_val)) to obtain a shap.Explanation, then pass explanation to shap.plots.beeswarm or explanation[i] to shap.plots.waterfall.