Closed imiordanov closed 3 years ago
Hi there. I don't think this is a bug, we do expect labels
to contain indices rather than label names. Your code will always generate explanations for labels [0, 1, 2...] rather than the top labels actually predicted (notice how enumerate will always give us this sequence regardless of what top_labels
is)
I see, actually this gives me some better insight into the code! Thank you, I will take this into consideration!
Hey there,
First of all, let me thank you for your work! Truly great tool!
I was playing around and I wanted to get results from LIME about a binary image classification model, and I stumbled across a small hiccup. When I would set the
labels
parameter to an array of strings, for example["OK", "NG"]
, I would get an error fromlime_base.py
on line 182 that indices need to be integers or ellipses. The function I was calling isLimeImageExplainer.explain_instance
, so I figured there was something wrong there. The label is passed as it is, so naturally"OK"
is not a valid index. I've introduced a simple enumeration over the labels, so I think the rest of the code should work as intended. If I have missed anything, please let me know.Thank you again!
Cheers.