I'm trying to apply Recurrent Tabular Explainar from LIME, however, I keep on getting the output that NoneType is not iterable. This even persists for this simple minimal example:
from lime import lime_tabular
x_train = np.random.randint(0, 6249, size=(10, 6249,1))
yy_train = np.random.randint(0, 10, size=(10,1))
explainer = lime_tabular.RecurrentTabularExplainer(x_train, training_labels=yy_train)
Can anybody help me and tell me what's wrong? Kind regards,
You are missing the feature_names
parameter. Although it has a default value (None), your RecurrentTabularExplainer
class will always need that parameter as it will perform an iteration on that list, in order to assign the name of columns of data.
As you have not specified it, it will try to iterate through a None object, hence the error.
Fill the feature_names
parameter as well with a list of strings, being the names corresponding to the columns in your training data.
from lime import lime_tabular
x_train = np.random.randint(0, 6249, size=(10, 6249,1))
yy_train = np.random.randint(0, 10, size=(10,1))
explainer = lime_tabular.RecurrentTabularExplainer(x_train, feature_names=yy_names, training_labels=yy_train)
Don't forget to specify yy_names
, such as yy_names = ['name1','name2','etc'...]