Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shap explanation for recursive multi-step forecasting #2488

Open
ncooder opened this issue Aug 1, 2024 · 4 comments
Open

Shap explanation for recursive multi-step forecasting #2488

ncooder opened this issue Aug 1, 2024 · 4 comments
Labels
feature request Use this label to request a new feature

Comments

@ncooder
Copy link

ncooder commented Aug 1, 2024

Shapley explanation works for the whole prediction set, however sometimes one needs to explain every step in the forecasting. This is a complex issue due to using different approaches - direct or recursive models. Is there a way to do it step-by-step for the whole horizon?

@ncooder ncooder added the triage Issue waiting for triaging label Aug 1, 2024
@madtoinou
Copy link
Collaborator

Hi @ncooder,

I am not sure to understand what you mean but you can find some information about explanability with Darts here.

The explain() method for example, allows you to specify a foreground series, which can be different than the series used during training, and get insights about this specific forecast. You can also tweak the number of explained steps with the horizons argument.

Let me know if it answers you questions.

@madtoinou madtoinou added question Further information is requested and removed triage Issue waiting for triaging labels Aug 15, 2024
@ncooder
Copy link
Author

ncooder commented Aug 17, 2024

@madtoinou Thank you for your response. I am implementing a recursive multi-step forecasting model for n-step ahead predictions. It involves iteratively forecasting one step ahead, adding each prediction into the dataset, and repeating with the same model.

My concern is the interpretation of shap explanation in this context. It is unclear for me whether shap in darts explains each one-step-ahead prediction individually or provides a global explanation for the entire n-step forecast.

@madtoinou
Copy link
Collaborator

madtoinou commented Aug 27, 2024

Since each iteration consists in forecasting only one step, the Darts implementation of shap should explain each one-step-ahead prediction. You can think of it as the explainer is bound to the model which was defined with output_chunk_length=1, hence, it is not able to do anything in the context of the recursive multi-step forecasting that you are applying on top of the original forecasting model. It would however work in the context of "direct" inference with a model defined using output_chunk_length=desired_horizon.

It might be possible to use shap in the context of recursive prediction but it's not yet implemented in Darts.

@madtoinou madtoinou changed the title Shap explanation Shap explanation for recursive multi-step forecasting Aug 27, 2024
@ncooder
Copy link
Author

ncooder commented Aug 27, 2024

@madtoinou Thank you for your reply. This is what I was asking for. If there is not an existing solution, please mark it as a feature that can be introduced in future versions of darts.

@madtoinou madtoinou added feature request Use this label to request a new feature and removed question Further information is requested labels Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Use this label to request a new feature
Projects
None yet
Development

No branches or pull requests

2 participants