marcotcr / lime

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

Error: The class of model must have a model_type method #670

Open Nehagupta90 opened 2 years ago

Nehagupta90 commented 2 years ago

I have a randomForest model and when I run

explainer <- lime(text_train, # the input model = r, # the model preprocess = tokenize_text) # the preprocessing step

explanation <- explain(text_test[2:5], explainer = explainer, n_labels = 1, # show only 1 label (recommend or not recommend) n_features = 5, feature_select = "highest_weights", # use all terms to explain the model single_explanation = F)

it gives error

Error: The class of model must have a model_type method. See ?model_type to get an overview of models supported out of the box

How to have a model_type ()