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

Skip to content

MNT Refactor/Improve features sampling in HGB splitting - #34786

Open
cakedev0 wants to merge 2 commits into
scikit-learn:mainfrom
cakedev0:hgb/split_candidates_sampling
Open

MNT Refactor/Improve features sampling in HGB splitting#34786
cakedev0 wants to merge 2 commits into
scikit-learn:mainfrom
cakedev0:hgb/split_candidates_sampling

Conversation

@cakedev0

@cakedev0 cakedev0 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Reference Issues/PRs

Will help in implementing strategy 4 described in #34764 (comment)

What does this implement/fix? Explain your changes.

It changes the features subsampling of HGB (when max_features < 1.0): instead of a boolean mask, it samples without replacement.

It has two benefits:

  • no "no-op" iteration inside the prange(..., schedule="static"), which will help for future scalability heuristic I'm working on
  • unbiased tie breaking behavior (but only for max_features < 1.0), as it randomized the order in which features are split (and we use > in the loop).

The effect on runtime is not visible as far as I could experiment, even in extreme cases where split time is dominant. But I think it should be visible in some (relatively rare) cases once combine with the "use_threads_if" heuristic as it allow having a more accurate estimate of the work to do.

There is no added complexity so it's worth the PR/merge I'd say.

AI usage disclosure

Very guided session, I had a precise idea of what I wanted.

@cakedev0 cakedev0 changed the title Improve split candidates sampling MNT Refactor/Improve features sampling in HGB splitting Aug 21, 2026

@ogrisel ogrisel 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. I agree that it's having parallel loops with more homogeneous workloads should help optimize the thread-scalability in subsequent PRs.

Another benefit: I find the code easier to reason about this way.

@ogrisel ogrisel added the Quick Review For PRs that are quick to review label Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cython module:ensemble Quick Review For PRs that are quick to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants