1
$\begingroup$

I am running models, and I am learning how to use LIME to explain the models. I trained a random forest, on data that has 988 rows and 5000 columns. However, I am getting an error which says Error: All permutations have no similarity to the original observation. Try setting bin_continuous to TRUE and/or increase kernel_size. I don't understand this, and I would appreciate edits to my code below. (Discalimer, this is a homework question).

This is my attempt below.

library(lime)
explainer_caret <- lime(training,  model_train)

pdf('lime_1_6.pdf')
explanation <- explain(testing[1:6, ], explainer_caret,
                       labels="positive",
                       n_permutations=5,
                       dist_fun="manhattan",
                       kernel_width = 3,
                       n_features = 10)
dev.off()

To try to fix this I tried one of the suggestions using https://goodekat.github.io/LIME-research-journals/journals/02-understanding_lime/02-understanding_lime.html as the guide:

explainer_caret <- lime(training, model_train,
                        preprocess = NULL, bin_continuous = TRUE,
                        n_bins = 4, quantile_bins = TRUE)
 pdf('lime_1_6.pdf')
explanation <- explain(testing[1:6, ], explainer_caret,
                       labels="positive",
                       n_permutations=5,
                       dist_fun="manhattan",
                       kernel_width = 3,
                       n_features = 10)
dev.off()

I still get this Error: All permutations have no similarity to the original observation. Try setting bin_continuous to TRUE and/or increase kernel_size

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.