SauceCat/PDPbox

one-hot encoding feature should contain more than 1 element

mjjun1 opened this issue · 1 comments

Hi,
I ran multiclass XGB with one target column, and execute the following pdp_isolate code. I got an error: "ValueError: one-hot encoding feature should contain more than 1 element". How I can fix it? Thank you in advance.

pdp_xgb = pdp.pdp_isolate(
model=xgb1, dataset=data, model_features=features, feature=['dis_suwK']
)

The list you supply for the feature parameter should be the one-hot encoded columns, i.e. if you have a feature colour=['red', 'green', 'blue'] you need to convert this to one-hot encoding so that you have columns 'red', 'green', and 'blue' that take on values of zero and one, then set feature=['red', 'green', 'blue'] when calling pdp_isolate.