neuralforecast icon indicating copy to clipboard operation
neuralforecast copied to clipboard

Unable to explain NeuralForecast model with SHAP

Open MyAdminC opened this issue 1 year ago • 0 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

MyAdminC avatar May 09 '24 13:05 MyAdminC