unit8co/darts

TFTExplainer: getting explanations when trained on multiple time series

Open

#2,489 建立於 2024年8月1日

在 GitHub 查看
 (5 留言) (0 反應) (0 負責人)Python (6,832 star) (762 fork)batch import
buggood first issue

描述

I have trained TFT on multiple time series (for example: trained on a retail dataset with 350 time series, each having target, past and future covariates). My understanding was that TFTExplainer would give importance (temporal and variable) based on what it learned from all the time series. To get these, I pass the backgorund_series (and other covariates) that I had used for training to the TFTExplainer. i.e. I pass all 350 series. This gives me the following error

Traceback (most recent call last): File "/main.py", line 90, in results = explainer.explain() File "/lib/python3.9/site-packages/darts/explainability/tft_explainer.py", line 224, in explain values=np.take(attention_heads[idx], horizon_idx, axis=0).T, IndexError: index 30 is out of bounds for axis 0 with size 30

I found that in TFTExplainer.explain(), the size of attention_heads is 30 and not 350.

When I pass only one series as background series, it works (size of attention_heads is 1).

How can I get global explanations for the TFT model when it is trained on multiple time series?

Thank you.

貢獻者指南