Repository navigation
ENH Specify categorical features with feature names in HGBDT - #24889
Merged
lorentzenchr merged 11 commits intoNov 13, 2022
Merged
lorentzenchr merged 11 commits into
lorentzenchr merged 11 commits into
Conversation
glemaitre
reviewed
Nov 10, 2022
glemaitre
reviewed
Nov 10, 2022
glemaitre
reviewed
Nov 10, 2022
thomasjpfan
reviewed
Nov 10, 2022
Co-authored-by: Guillaume Lemaitre <[email protected]>
Co-authored-by: Guillaume Lemaitre <[email protected]>
lorentzenchr
approved these changes
Nov 12, 2022
lorentzenchr
left a comment
Member
There was a problem hiding this comment.
LGTM, only some questions.
This will improve user friendliness soooo much!!!
| "on data without feature names." | ||
| ) | ||
| is_categorical = np.zeros(n_features, dtype=bool) | ||
| feature_names = self.feature_names_in_.tolist() |
Member
There was a problem hiding this comment.
Is this conversion to a list necessary?
Member
Author
There was a problem hiding this comment.
Arrays do not have the index method. Not sure how to implement this while staying in numpy and making it easy to raise the error message timely at the same time.
Member
Author
There was a problem hiding this comment.
Also, the feature names list should never be to long (few hundred values) for HGBDT models in practice because those models tend to perform poorly when n_features >> n_samples.
Member
There was a problem hiding this comment.
Thanks for the explanation.
lorentzenchr
approved these changes
Nov 13, 2022
Member
Author
|
Thank for the final fixes @lorentzenchr! |
This was referenced Nov 13, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Similar to #24855 but for the
categorical_featuresparameter as stated in #24852 (comment).Note that this works well with the
.set_output("pandas")of this release.However it requires disabling the verbose column names of the column transformer :)
Note: in the future we might directly inspect dataframe column dtypes in HGBDT and have an "auto" mode to trigger native categorical support for explicitly encoded categorical dtyped columns, but this will be the topic for a later PR.