NorskRegnesentral / shapr

Explaining the output of machine learning models with more accurately estimated Shapley values
https://norskregnesentral.github.io/shapr/
Other
138 stars 32 forks source link

argument "x" is missing, with no default #339

Closed djd224 closed 1 year ago

djd224 commented 1 year ago

Hello all!

I am interested in importing my PyTorch model into R in order to use the shapr package for further analysis of the model.

I trained the model in PyTorch, implemented it in R using the relatively new 'torch' package, and am now following the custom model example to apply shapr. However, when running the explain function, I get the following error:

Error in explain(model = model_gbm, x_explain = x_explain, x_train = x_train, : argument "x" is missing, with no default

In order to make sure it wasn't a problem with the format of my data/model, I ran the code provided for the custom model explanation using the sample gbm model and returned the same error.

Any guidance on this issue would be greatly appreciated. Thank you!

martinju commented 1 year ago

Hi. What version of shapr are you using? I pushed a new version to maste ron GitHub just today, which has a series of breaking changes.

If you are not using the GitHub version, would you mind trying with that? Note that the functions you create to explain custom models are passed directly to explain() in the new syntax.

djd224 commented 1 year ago

I installed the current GitHub version and it seems to have resolved the issue. Thank you for your help!