How to save a shap.DeepExplainer (SwigPyObject) to a file?

Viewed 690

I tried to save my shap explainer of type DeepExplainer using pickle.dump, but I get the error: can't pickle SwigPyObject objects. My code:

my_shap_explainer = DeepExplainer(my_model, background)
pickle.dump(my_shap_explainer, my_file)
TypeError: can't pickle SwigPyObject objects

What is the best way to store this class to a file?

0 Answers
Related