Skip to content

Issue when initializing explainer through TabularExplainer and KernelExplainer #463

@lucazav

Description

@lucazav

I have a trained regression model (a VotingEnsemble model obtained through training with Azure AutoML) and I'd like to generate an explainer using TabularExplainer.
My dataset has a column ('CALENDAR_DATE') of type datetime64[ns], which my model handles correctly (predict method works fine).
After the import of the TabularExplainer class, I tried to initialize my explainer through:

features = X_train.columns

explainer = TabularExplainer(model,
                                  X_train,
                                  features=features,
                                  model_task = 'regression')

but I get the following error:

RuntimeError: cuML is required to use GPU explainers.
Check https://rapids.ai/start.html for more
information on how to install it.
The above exception was the direct cause of the following exception:
[...]
ValueError: Could not find valid explainer to explain model

I get the same error message when I force:

explainer = TabularExplainer(model,
                                  X_train,
                                  features=features,
                                  model_task = 'regression',
                                  use_gpu=False)

Thus, I proceeded trying to explicitly inizialize a KernelExplainer, thorugh:

explainer = KernelExplainer(model,
                                 X_train,
                                 features=features,
model_task = 'regression')

but I received the error:

float() argument must be a string or a number, not 'Timestamp'

Therefore I changed the 'CALENDAR_DATE' column type to string, with:

X_train_copy = X_train.copy()
X_train_copy['CALENDAR_DATE'] = X_train_copy['CALENDAR_DATE'].astype(str)

After this, both TabularExplainer and KernelExplainer correctly work when initializing the explainers (with the modified dataset X_train_copy).

Why does this happen?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions