lime icon indicating copy to clipboard operation
lime copied to clipboard

TypeError: list indices must be integers or slices, not tuple".

Open tadepoju opened this issue 4 years ago • 1 comments

I am also getting the same error as mentioned in issue #632

" labels_column = neighborhood_labels[:, label] TypeError: list indices must be integers or slices, not tuple".

This seems like an issue related to something happening within the lime_base script as I have no tuples in my code and any lists I index are solely with indices.

I hadn't realised it was specifically impacted by the number of samples. I also do not need 5000 samples so ideally would like to find a solution to make it work with a lower number of samples without getting that error.

tadepoju avatar Sep 23 '21 09:09 tadepoju

Hello @tadepoju , I happend upon this error as well. I turns out the predictor method that is passed to the explain_instance method needs to return a numpy array, because it access the values via multidimensional slicing.

Solution: Return a numpy array in the prediction function. You can transform a regular nested list as follows: prediction = np.array(prediction)

Hope this helps!

stereolith avatar Jan 16 '22 17:01 stereolith