marcotcr / lime

Lime: Explaining the predictions of any machine learning classifier
BSD 2-Clause "Simplified" License
11.5k stars 1.79k forks source link

Incompatibility between versions 3.6 and 3.7 #571

Closed ivanovys closed 3 years ago

ivanovys commented 3 years ago

Good day!

The expliner was trained in python version 3.7 and packaged in dill

after unpacking dill.load () in python 3.6 the launch happens in the docker container I call the .explain_instance method and get an error

Traceback (most recent call last): module | File "predict.py", line 152, in predict module | exp = explainer.explain_instance (np.array (feature_values), model.predict_proba, num_features = num_features) module | File "/usr/local/lib/python3.6/site-packages/lime/lime_tabular.py", line 340, in explain_instance module | data, inverse = self . data_inverse (data_row, num_samples) module | File "/usr/local/lib/python3.6/site-packages/lime/lime_tabular.py", line 536, in data_inverse module | first_row = self.discretizer.discretize (data_row) module | File "/usr/local/lib/python3.6/site-packages/lime/discretize.py", line 110, in discretize module | ret [feature] = int (self.lambdas [feature] (ret [feature])) module | File "/relearning/env/lib/python3.7/site-packages/lime/discretize.py", line 72, in module | self.lambdas [feature] = lambda x, qts = qts: np.searchsorted (qts, x) module | SystemError: unknown opcode

Is it possible to run explainer without upgrading the image to 3.7?

Thank you

marcotcr commented 3 years ago

Sorry, I have no idea ;)