marcotcr / lime

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

Heuristics to get a positive / negative explanation for an image model #253

Closed venkataramanam closed 6 years ago

venkataramanam commented 6 years ago

Hi, We are trying to arrive at positive and negative image explanation with a fixed heuristic that works for all kinds of image resolutions. In the sense, once the explanation is generated by LIME, in order to get two images which display the areas which have contributed positively towards the prediction and the features which have negatively contributed, we need to be sending the number of features (super-pixels) to include in the explanation. Is there a good heuristic that you suggest to arrive at a value of num_features (arg to get_image_and_mask) based on the image and the explanation output?

Thanks Venkat

marcotcr commented 6 years ago

If you are generating explanations for multiple images, and want to meaningfully compare them, I would actually suggest setting min_weight to something you consider significant and letting num_features be 1000000 (infinite), so that you only get superpixels that contribute by at least min_weight to the prediction. Otherwise, the positive superpixels in an image are not really comparable to another, as they may have very low weight while the other has very high weight.