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

Where to input predict_model function when using custom models #341

Closed WenjuanW closed 1 year ago

WenjuanW commented 1 year ago

Hi, I am trying to use this package for a custom model. I understood that I need to have a predict_model function and may be a get_model_specs function. But when I look at the example provided, I did not find where to input this predict_model. Could you explain how the predict_model function is used please? Thanks for the help! Best wishes, Wenjuan

martinju commented 1 year ago

Hi

If you are using the most recent GitHub version of the shapr package, you can pass it directly to explain(), see: https://norskregnesentral.github.io/shapr/articles/understanding_shapr.html#explain-custom-models

If you are using the CRAN version, you don't need to pass it, but rather create them as class functions. See the vignette in the package; from the R console do: vignette("understanding_shapr", "shapr")

Let me know if you still got issues.