Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] for Ch4/08_LimeDemo.ipynb #109

Open
mralamdari opened this issue May 30, 2022 · 2 comments
Open

[BUG] for Ch4/08_LimeDemo.ipynb #109

mralamdari opened this issue May 30, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@mralamdari
Copy link

Problem

in Part 2: Using Lime to interpret predictions,

mystring = list(X_test)[221]
print(c.predict_proba([mystring])

there is an extra list and it gives this error:

AttributeError: 'list' object has no attribute 'replace'

and this error refers to this line of the code in the clean function:
doc = doc.replace("</br>", " ")

Solution:

this problem can easily be solved by removing the list part and changing the code to this:

mystring = X_test[221] print(c.predict_proba([mystring])

@mralamdari mralamdari added the bug Something isn't working label May 30, 2022
@mralamdari
Copy link
Author

mralamdari commented May 30, 2022

Attention!!!

if you don't change
mystring = list(X_test)[221]

to this code:

mystring = X_test[221]

while running these part:

exp = explainer.explain_instance(mystring, c.predict_proba, num_features=6)

it will raise this Error:

TypeError: expected string or bytes-like object

@Ethan0456
Copy link
Collaborator

This issue is resolved in this PR #133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants