marcotcr / lime

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

ImportError: cannot import name 'submodular_pick' #237

Closed neerajnj10 closed 5 years ago

neerajnj10 commented 6 years ago

Hi @marcotcr , can you see why this problem would happen? I have imported lime and all other functions are fine but importing submodular_pick gives the above error, i sthere any way around it?

Thanks.

Nearby36 commented 6 years ago

Maybe you can update your lime package to the newest, then reopen your python file.

neerajnj10 commented 6 years ago

@marcotcr, I have updated most recent update available for conda environment, and it still does not work. https://anaconda.org/conda-forge/lime

neerajnj10 commented 6 years ago

In addition, I wanted to know in text explainer, where the result includes predicted probabilities along with useful words that contributed to the prediction for each label, for example class 1 - had 4 text while class 0 had 2 text words (resultant prediction is class 1), when we convert the result to list, it gives all 6 words combined, but out of those, only 4 words are actually useful in class 1 prediction, while 2 words that help towards class 0, can they be removed from the list? There are weightage associated with each words in the list, does not negative weight mean they are for class 0 and if so, extracting only positive weighted words can help in creating list of words for class 1 labels? I have this project I am working on, that could use details like this. If I am incorrect, what is the correct way to implement it for each class for each observation (each text row). Thanks

marcotcr commented 5 years ago

Sorry for the delay in responding. The problem is you are using lime 0.1.1.31, and we added submodular pick in 0.1.1.32. 0.1.1.32 is in pypi, so you can just pip install lime and it should work. I don't know how packages get added to conda and how they are updated.

As to your other question: the default explanation is for class 1 (you can change this through the label parameter), so negative weight means the word contributes towards class 0 and positive weight means the word contributes towards class 1. If you just want to see words positive towards a certain class, you can just filter the resulting explanation to include only positive or negative weighted terms.