Nixtla / neuralforecast

Scalable and user friendly neural :brain: forecasting algorithms.

Home Page:https://nixtlaverse.nixtla.io/neuralforecast

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to explain NeuralForecast model with SHAP

MyAdminC opened this issue · comments

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