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

Unable to explain NeuralForecast model with SHAP #996

Open
MyAdminC opened this issue May 9, 2024 · 0 comments
Open

Unable to explain NeuralForecast model with SHAP #996

MyAdminC opened this issue May 9, 2024 · 0 comments

Comments

@MyAdminC
Copy link

MyAdminC commented May 9, 2024

Description

Hello, I'm trying to use the NeuralForecast model, which works really well, Thanks a lot.

But I've recently run into an issue where I can't use shap to interpret:
nf = NeuralForecast(models=[NHITS_modle], freq=1)

I think this may be because the model itself is encapsulated by NeuralForecast. Because I've seen shap used in Mlforecast, and that work well.

I tried using the following code:

X = Y_df.drop(columns=['unique_id', 'ds', 'y'])
X100 = shap.utils.sample(X, 100)

explainer = shap.Explainer(nf.models[0].predict, X100)
shap_values = explainer(X)

But the last line throws up all sorts of errors, Any advice would be greatly appreciated!

Use case

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant