Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with ExplainableBoostingRegressor: unsupported feature type 'ordinal' #16

Open
zuberman35 opened this issue Sep 8, 2023 · 5 comments

Comments

@zuberman35
Copy link

After training an EBM Regressor and manually specifying the datatypes to 'nominal or 'ordinal' ( as categorical is not supported) I cannot create a gc, even when manually trying to change the feature_types. See below example for the MPG dataset.

ebm = ExplainableBoostingRegressor(
    feature_names=['displacement', 'horsepower', 'weight', 'acceleration','origin', 'cylinders', 'model_year'
       ],
    feature_types=['continuous', 'continuous','continuous','continuous','nominal','ordinal','ordinal'],
    random_state=42,
    n_jobs=-1
)
ebm.fit(X_train, y_train)
ebm.feature_types = ['continuous', 'continuous', 'continuous', 'continuous', 'categorical', 'categorical', 'categorical']

gc only seems to work with feature_type='none'.

Is there a workaround or fix?

@zuberman35 zuberman35 changed the title unsupported feature type 'ordinal' Incompatibility with ExplainableBoostingRegressor: unsupported feature type 'ordinal' Sep 8, 2023
@paulbkoch
Copy link

paulbkoch commented Sep 8, 2023

To hack this, try this instead (NOTE: I have not tested this):

ebm.feature_types_in_ = ['continuous', 'continuous', 'continuous', 'continuous', 'categorical', 'categorical', 'categorical']

@paulbkoch
Copy link

paulbkoch commented Sep 8, 2023

Actually, looking at the code I think it will instead need to be:

ebm.feature_types_in_ = ['continuous', 'continuous', 'continuous', 'continuous', 'nominal', 'nominal', 'nominal']

Because here 'nominal' is supported, but not 'categorical' or 'ordinal'. For prediction 'nominal' and 'ordinal' will be identical:

elif col_type == "nominal":

elif col_type == "nominal":

@zuberman35
Copy link
Author

This worked, thanks for the lightning fast response :)

@zuberman35
Copy link
Author

While this fix works in a sense, that it displays the gc visual, the metrics (right) are now gone, see below screenshot
image

@paulbkoch
Copy link

Two questions:

  1. If you train the model using only nominals (no ordinals), does it still have this visualization issue. My guess is that it will.
  2. What datatypes are the columns of X? If you force the nominal and ordinal columns to be strings, does that fix the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants