marcotcr / lime

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

sample_around_instance =True #636

Open uttiyamaji opened 3 years ago

uttiyamaji commented 3 years ago

In LimeTabularExplainer(), if we set sample_around_instance = True, then it sets data = data + instance. (in __data_inverse() call, after explain_instance() call).

But then when it returns data, inverse, we do scaleddata = (data - self.scalar.mean)/self.scalar.scale_.

But self.scalar.mean_ stores the mean of the feature over the training sample (self.scaler.fit(training_data)) and not the instance, so are we re-standardizing the data correctly in this case?

shouldn't we standardize with the instance here? or at least with the sample mean of the generated sample?