Thanks to visit codestin.com
Credit goes to github.com

Skip to content

PRF simpler missing values handling in HGB - #34335

Merged
adam2392 merged 4 commits into
scikit-learn:mainfrom
cakedev0:refactor/hgb/simpler_missing
Jun 21, 2026
Merged

PRF simpler missing values handling in HGB#34335
adam2392 merged 4 commits into
scikit-learn:mainfrom
cakedev0:refactor/hgb/simpler_missing

Conversation

@cakedev0

Copy link
Copy Markdown
Contributor

This refactor removes the need for _find_best_bin_to_split_right_to_left in sklearn/ensemble/_hist_gradient_boosting/splitting.pyx

Reference Issues/PRs

None.

But I will open a PRF PR soon that optimizes something in this function, so it's nice not to have to write it twice.

What does this implement/fix? Explain your changes.

I added an argument missing_go_to_left in _find_best_bin_to_split_left_to_right (now renamed _find_best_bin_to_split_numerical) so we don't need _find_best_bin_to_split_right_to_left.

As explained in the docstring of _find_best_bin_to_split_numerical: "We scan node from left to right. When missing_go_to_left is True, the scan starts by adding the missing-value bin to the left child before scanning the non-missing bins."

Note that this matches how we do it in tree, which I think is nice: it's easier for us (tree/hgb contributors) to maintain a single unified mental model when possible.

AI usage disclosure

I used AI assistance for:

  • Code generation (closely guided)
  • Documentation & naming

@github-actions github-actions Bot added module:ensemble cython CI:Linter failure The linter CI is failing on this PR labels Jun 19, 2026
@github-actions github-actions Bot removed the CI:Linter failure The linter CI is failing on this PR label Jun 19, 2026

@virchan virchan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks, @cakedev0!

@virchan virchan added the Waiting for Second Reviewer First reviewer is done, need a second one! label Jun 20, 2026
@adam2392
adam2392 self-requested a review June 21, 2026 16:42

@adam2392 adam2392 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice simplification @cakedev0 !

@adam2392
adam2392 merged commit c78c84d into scikit-learn:main Jun 21, 2026
43 checks passed
@cakedev0 cakedev0 moved this to Done in Labs Jun 24, 2026
@cakedev0 cakedev0 added this to Labs Jun 24, 2026
@cakedev0 cakedev0 changed the title simpler missing values handling PRF simpler missing values handling in HGB Jun 25, 2026
prady0t pushed a commit to prady0t/scikit-learn that referenced this pull request Sep 2, 2026
@jeremiedbb jeremiedbb mentioned this pull request Sep 8, 2026
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cython module:ensemble Waiting for Second Reviewer First reviewer is done, need a second one!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants