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

Documentation claims shaprpy can explain Keras models, but code claims it cannot #394

Open
mdhimes opened this issue Apr 23, 2024 · 0 comments

Comments

@mdhimes
Copy link

mdhimes commented Apr 23, 2024

Hello. I am using the Python interface, shaprpy. The documentation for it claims that
"shaprpy knows how to explain predictions from models from sklearn, keras and xgboost. For other models, one can provide a custom predict_model function (and optionally a custom get_model_specs) to shaprpy.explain."

However, when using a Keras model, the following warning arises:
".../shapr/python/shaprpy/explain.py:255: UserWarning: No pre-built get_model_specs for model of type <class 'keras.src.engine.functional.Functional'>, disabling checks.
warnings.warn(f'No pre-built get_model_specs for model of type {type(model)}, disabling checks.')
R[write to console]: Note: You passed a model to explain() which is not natively supported, and did not supply a 'get_model_specs' function to explain().
Consistency checks between model and data is therefore disabled."

This quite plainly states that a Keras model "is not natively supported", which seems at odds with the documentation. Looking in the code seems to confirm this:
https://github.com/NorskRegnesentral/shapr/blob/master/python/shaprpy/explain.py#L313
Note that only sklearn and xgboost are included in this function, but not Keras.

Is this expected behavior? If so, the warning should be suppressed for this case. If not, the documentation should be updated to remove mention of native support for Keras models.

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

No branches or pull requests

1 participant