DOC: clarify categorical missing docs (HGB & trees) - #34553
Merged
thomasjpfan merged 142 commits intoJul 24, 2026
Merged
Conversation
…into nocats-v2
Co-authored-by: Arthur Lacote <[email protected]>
Co-authored-by: Arthur Lacote <[email protected]>
Co-authored-by: Christian Lorentzen <[email protected]>
…orical-missing-docs
cakedev0
commented
Jul 23, 2026
Comment on lines
-1461
to
-1463
| dtypes are treated as missing values. All categorical values are | ||
| converted to floating point numbers. This means that categorical values | ||
| of 1.0 and 1 are treated as the same category. |
Contributor
Author
There was a problem hiding this comment.
All categorical values are converted to floating point numbers. This means that categorical values of 1.0 and 1 are treated as the same category.
This sentence is weird and probably dating from before using OrdinalEncoder. With ordinal encoder, the case of feeding 1 and 1.0 can't really happen:
- features mixing string and numerical are forbidden.
- arrays or Series mixing 1 and 1.0 will be float dtype and 1 will 1.0, so the "collision" happens before it reaches scikit-learn.
IMO, this is using a lot of users' cognitive space for something users won't encounter. We don't have a similar sentence in encoders doc, so why here?
But if reviewers disagree with removing this sentence, I'll just revert the last commit.
cakedev0
marked this pull request as ready for review
July 23, 2026 09:02
10 tasks
adam2392
approved these changes
Jul 23, 2026
prady0t
pushed a commit
to prady0t/scikit-learn
that referenced
this pull request
Sep 2, 2026
Co-authored-by: Adam Li <[email protected]> Co-authored-by: Adam Li <[email protected]> Co-authored-by: Christian Lorentzen <[email protected]> Co-authored-by: Thomas J. Fan <[email protected]>
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.
While reviewing #33354, Codex noticed the wording of the docstring was incorrect regarding negative values for categorical features: "Negative values for categorical features encoded as numeric dtypes are treated as missing values". There just treated as normal categories.
Reference Issues/PRs
Follow-up from #33354
What does this implement/fix? Explain your changes.
Fixes the wording, and also proposes to trim a part that's not informative IMO (more details in a inline comment)
AI usage disclosure
I used AI assistance for: