Skip to content

Fix RandomForestRegressor default max_features#6862

Merged
rapids-bot[bot] merged 1 commit intorapidsai:branch-25.08from
jcrist:fixup-rf-regressor-max-features
Jun 10, 2025
Merged

Fix RandomForestRegressor default max_features#6862
rapids-bot[bot] merged 1 commit intorapidsai:branch-25.08from
jcrist:fixup-rf-regressor-max-features

Conversation

@jcrist
Copy link
Copy Markdown
Member

@jcrist jcrist commented Jun 5, 2025

This was a bug introduced with the removal of max_features="auto". The default value for RandomForestRegressor should be 1.0, while the default for RandomForestClassifier should be "sqrt". They were both erroneously set to "sqrt".

@jcrist jcrist self-assigned this Jun 5, 2025
@jcrist jcrist added the bug Something isn't working label Jun 5, 2025
@jcrist jcrist requested a review from a team as a code owner June 5, 2025 20:05
@jcrist jcrist added the Cython / Python Cython or Python issue label Jun 5, 2025
@jcrist jcrist requested review from bdice and csadorf June 5, 2025 20:05
@jcrist jcrist added the non-breaking Non-breaking change label Jun 5, 2025
Copy link
Copy Markdown
Contributor

@csadorf csadorf left a comment

Choose a reason for hiding this comment

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

Thanks for the catch and the quick fix!

Can you add a unit test that would captures this bug, please?

This was a bug introduced with the removal of `max_features="auto"`. The
default value for `RandomForestRegressor` should be `1.0`, while the
default for `RandomForestClassifier` should be `"sqrt"`. They were both
erroneously set to `"sqrt"`.
@jcrist jcrist force-pushed the fixup-rf-regressor-max-features branch from 9401869 to 3175146 Compare June 10, 2025 14:42
@jcrist
Copy link
Copy Markdown
Member Author

jcrist commented Jun 10, 2025

Can you add a unit test that would captures this bug, please?

Done. I originally hadn't added a test since it felt a bit silly to check that the defaults were the defaults, but it was easy to add and fine if it gives us peace-of-mind.

@csadorf
Copy link
Copy Markdown
Contributor

csadorf commented Jun 10, 2025

Can you add a unit test that would captures this bug, please?

Done. I originally hadn't added a test since it felt a bit silly to check that the defaults were the defaults, but it was easy to add and fine if it gives us peace-of-mind.

Thanks a lot. I think the very existence of the bug demonstrates that it's not silly. ;)

@jcrist
Copy link
Copy Markdown
Member Author

jcrist commented Jun 10, 2025

/merge

@rapids-bot rapids-bot Bot merged commit 72953a8 into rapidsai:branch-25.08 Jun 10, 2025
177 of 181 checks passed
@jcrist jcrist deleted the fixup-rf-regressor-max-features branch June 10, 2025 17:49
rapids-bot Bot pushed a commit that referenced this pull request Jun 11, 2025
This ports `RandomForestClassifier` and `RandomForestRegressor` to subclass from `InteropMixin` and `ProxyBase`.

Fixes #6707.

Todo:
- [x] Rebase on top of #6854, #6862, and #6873
- [x] Add interop tests in `test_sklearn_import_export.py`
- [x] Update xfail list

Authors:
  - Jim Crist-Harif (https://github.com/jcrist)

Approvers:
  - Simon Adorf (https://github.com/csadorf)

URL: #6863
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Cython / Python Cython or Python issue non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants