-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Partial dependence broken when categorical_features has an empty list #31077
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
Comments
We should not accept an empty list indeed and raise a better error message. |
… empty list Passing an empty list to `categorical_features` in `partial_dependence` was causing a ValueError with an unclear message. Now, we explicitly check for this case and raise a clearer ValueError instructing users to use `None` instead. Added a test case to ensure proper exception handling. Signed-off-by: Pedro Lopes <pedro.m.a.r.lopes@tecnico.ulisboa.pt>
… empty list Passing an empty list to `categorical_features` in `partial_dependence` was causing a ValueError with an unclear message. Now, we explicitly check for this case and raise a clearer ValueError instructing users to use `None` instead. Added a test case to ensure proper exception handling. Signed-off-by: Pedro Lopes <pedro.m.a.r.lopes@tecnico.ulisboa.pt>
Any reason why empty lists should not be accepted? I feel like giving an empty list What do you think? |
I agree that if empty lists were accepted, the behavior should be the same as None. However I don't think that we should accept them. They weren't accepted before, the only thing that changed is that now we raise a more informative error message. So unless it represents a big convenience feature for the users, in which case we should reconsider, let's not introduce a new feature (small one but still) because it increases the maintenance burden. |
Describe the bug
When we pass an empty list to categorical_features, partial_dependence will raise an error ValueError: Expected categorical_features to be an array-like of boolean, integer, or string. Got float64 instead.
Steps/Code to Reproduce
Expected Results
.
Actual Results
Versions
The text was updated successfully, but these errors were encountered: