问题
How can I pickle a python object which contains lambdas?
Can't pickle local object 'BaseDiscretizer.__init__.<locals>.<lambda>'
is the error I get when trying to pickle https://github.com/marcotcr/lime/blob/97a1e2d7c1adf7b0c4f0d3b3e9b15f6197b75c5d/lime/discretize.py when pickling the https://github.com/marcotcr/lime/blob/2703bcdcddd135947fe74e99cc270aa4fac3263a/lime/lime_tabular.py#L88 LimeTabularExplainer
回答1:
The standard pickle
module cannot serialize lambdas, but there is a third party package called dill which supports them.
来源:https://stackoverflow.com/questions/45715996/python-pickle-object-with-lambdas