marcotcr / lime

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

active sampling strategy #654

Open chandan21gupta opened 2 years ago

chandan21gupta commented 2 years ago

Having used this library, I encountered some problems, which required frequent edits in the source code. Here I have added three functions : 1) Generate Samples -> Sometimes we just need perturbed samples for custom explanations. Made a function for that. 2) Active Sampling Strategy -> Used an active sampling approach where those perturbed samples can be used which the explainable model is least certain about, by comparing the predicted labels with the black box and selecting those perturbed samples which are farthest. 3) perturbation_predict -> Added a function which given a perturbed (or even a real datapoint), gives the corresponding prediction. This was also raised in issue no. #639.

Note -> These methods have only been implemented for tabular lime. If it gains popularity I shall extend it to other types of explanations as well.

The major change is the sampling approach. Although further experiments are required, this might be ideal for researchers to use, as active learning can significantly reduce number of perturbations. Feedbacks are welcome!