Home > Back-end >  Name 'lime_tabular' is not defined - ML Package
Name 'lime_tabular' is not defined - ML Package

Time:01-14

I already referred the posts here,here,and here. So, don't mark it as duplicate

I am trying to execute a tutorial as provided here (binary classification of breast cancer)

When I execute the below piece of code, I get an error as shown below

explainer = lime_tabular.LimeTabularExplainer(X_train, mode="classification",
                                              class_names=breast_cancer.target_names,
                                              feature_names=breast_cancer.feature_names,
                                             )

explainer

NameError: name 'lime_tabular' is not defined

But my code already has the below import statements

import lime
import lime.lime_tabular

What is causing this issue?

CodePudding user response:

You are not giving a name to the imported resource.

You can either use lime.lime_tabular when you are calling it on the code,

or change the second line of import to from lime import lime_tabular

The second approach would be the one I prefer when I code.

  •  Tags:  
  • Related