Skip to content

Commit

Permalink
Fix/ShapExplainer-summary_plot-Horizon-does-not-include-output_chunk_…
Browse files Browse the repository at this point in the history
…shift (#2647)

* Add output_chunk_shift to summary_plot title

* Update CHANGELOG.md

* Update darts/explainability/shap_explainer.py

Co-authored-by: Dennis Bader <[email protected]>

---------

Co-authored-by: Dennis Bader <[email protected]>
  • Loading branch information
cnhwl and dennisbader authored Jan 21, 2025
1 parent 0a52490 commit c52ec83
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ but cannot always guarantee backwards compatibility. Changes that may **break co

**Fixed**
- Fixed a bug when performing optimized historical forecasts with `stride=1` using a `RegressionModel` with `output_chunk_shift>=1` and `output_chunk_length=1`, where the forecast time index was not properly shifted. [#2634](https://github.com/unit8co/darts/pull/2634) by [Mattias De Charleroy](https://github.com/MattiasDC).
- Fixed the `ShapExplainer` `summary_plot` title where Horizon does not include `output_chunk_shift`. [#2647](https://github.com/unit8co/darts/pull/2647) by [He Weilin](https://github.com/cnhwl).

**Dependencies**

Expand Down
6 changes: 5 additions & 1 deletion darts/explainability/shap_explainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,11 @@ def summary_plot(

for t in target_components:
for h in horizons:
plt.title("Target: `{}` - Horizon: {}".format(t, "t+" + str(h)))
plt.title(
"Target: `{}` - Horizon: {}".format(
t, "t+" + str(h + self.model.output_chunk_shift)
)
)
shap.summary_plot(
shaps_[h][t],
foreground_X_sampled,
Expand Down

0 comments on commit c52ec83

Please sign in to comment.