lime icon indicating copy to clipboard operation
lime copied to clipboard

Saving an Explainer

Open ryanhalabi opened this issue 8 years ago • 1 comments

Is there a way to save an explainer object so it can be loaded later without needing to build it against the full dataset?

I've tried pickling it but it returns

explainer = lime.lime_tabular.LimeTabularExplainer( np.array(X), feature_names=X.columns, class_names=['x', 'y'], discretize_continuous=True)

with open('explainer.pkl', 'wb') as f:
    pickle.dump( explainer , f, pickle.HIGHEST_PROTOCOL)
AttributeError                            Traceback (most recent call last)
<ipython-input-90-9e7a99eff9e4> in <module>()
      1 with open('explainer.pkl', 'wb') as f:
----> 2     pickle.dump( explainer , f, pickle.HIGHEST_PROTOCOL)

AttributeError: Can't pickle local object 'BaseDiscretizer.__init__.<locals>.<lambda>'

ryanhalabi avatar Dec 07 '17 20:12 ryanhalabi

use dill. See also #98, #61

marcotcr avatar Dec 07 '17 20:12 marcotcr