Add per-timestep TFT variable importance plot - #3174
Open
exactml wants to merge 7 commits into
Open
Conversation
added 3 commits
August 1, 2026 15:05
Visualizes the per-timestep encoder/decoder variable importances exposed via get_encoder_importance_over_time()/get_decoder_importance_over_time(), following up on unit8co#2685. Mirrors plot_attention()'s show_index_as convention and reuses TimeSeries.plot()'s max_nr_components cap and date-axis handling instead of a hand-rolled stacked-bar chart.
Covers subplot titles/count, per-variable line count, max_nr_components capping, and the show_index_as validation error.
PR number is a placeholder (#XXXX) until the PR against unit8co/darts is actually opened.
added 4 commits
August 1, 2026 15:08
Uses a 60/20-timestep daily input/output chunk length with 36/18 encoder/decoder variables (>20, marked slow) to confirm the default max_nr_components cap and TimeSeries.plot()'s date-axis handling keep the plot readable at realistic scale, not just on the small fixtures used elsewhere in this file.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3174 +/- ##
==========================================
- Coverage 97.03% 96.97% -0.06%
==========================================
Files 165 165
Lines 17951 17982 +31
==========================================
+ Hits 17418 17438 +20
- Misses 533 544 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
@dennisbader can you review it when you available? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist before merging this PR:
Addresses #2685.
Summary
Adds the plotting follow-up to #3170 (which added the per-timestep data layer but intentionally left visualization out of scope).
TFTExplainer.plot_variable_selection_over_time()plots the encoder/decoder variable importances fromget_encoder_importance_over_time()/get_decoder_importance_over_time()as two line-chart subplots (one line per variable), instead of the stacked-bar approach originally prototyped in the issue thread.show_index_as: Literal["relative", "time"] = "relative"mirrors the existingplot_attention()convention."relative"re-indexes both series around the first prediction point (0);"time"uses the real dates the importances were already computed against, unchanged.max_nr_componentscaps how many variable lines are drawn per subplot, reusing the same knobTimeSeries.plot()already exposes — addresses the "unreadable past ~20 features" issue @MichaelVerdegaal raised in the thread.input_chunk_lengthseries — verifiedTimeSeries.plot()'s existing date-axis handling already degrades gracefully on long date ranges.Other Information
Testing:
test_variable_selection_over_time_plottingintest_tft_explainer.py, covering bothn_seriescases: subplot titles/count, per-variable line count,max_nr_componentscapping, and theshow_index_asvalidation error.pytest darts/tests/explainability/test_tft_explainer.py— 54 passed.