marcotcr / lime

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

Calculate r2 score #662

Open SamiurRahman1 opened 2 years ago

SamiurRahman1 commented 2 years ago

Is it possible to calculate the r2 score of the surrogate model? Can this feature be added?

genny92cst commented 2 years ago

did you solve this issue in any way?

SamiurRahman1 commented 2 years ago

no. unfortunately not.. :(

amindadgar commented 1 year ago

Hello This is a pretty easy thing to do since it has been implemented before in this library. To find the r2 score of the surrogate model you can use the score parameter that is returned from the explain_instance method. It's actually the r2 score of the surrogate model (which is by default the ridge regression). To do it

explanation = explain_instance(data, ... and some parameters)
print(explanation.score)