-
Notifications
You must be signed in to change notification settings - Fork 861
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
Add enable_categorical=True support to XGBoost #3286
Conversation
if is_train: | ||
self._ohe_generator.fit(X) | ||
if self._ohe: | ||
if self._ohe_generator is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the model is re-trained (i.e. on the full data), wouldn't this reuse the generator. I think it's better to always create a new one if is_train and self._ohe
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, re-training would be a new class instance, it does not cause issues
self._ohe = False | ||
else: | ||
"""One-hot-encode categorical features""" | ||
self._ohe = True | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
self._ohe = not enable_categorical
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, but will keep as is since I have docstrings to describe what True and False mean inline.
Note: CI failures are from AutoMM, unrelated to this PR. All tabular tests and CI builds succeeded. |
Job PR-3286-80d04e3 is done. |
Issue #, if available:
Resolves #2429
Description of changes:
enable_categorical=True
.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.