Incompatibility with ExplainableBoostingRegressor: unsupported feature type 'ordinal'
zuberman35 opened this issue · 5 comments
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?
To hack this, try this instead (NOTE: I have not tested this):
ebm.feature_types_in_ = ['continuous', 'continuous', 'continuous', 'continuous', 'categorical', 'categorical', 'categorical']
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:
This worked, thanks for the lightning fast response :)
Two questions:
- If you train the model using only nominals (no ordinals), does it still have this visualization issue. My guess is that it will.
- What datatypes are the columns of X? If you force the nominal and ordinal columns to be strings, does that fix the issue?