Skip to content

DOC improve RandomForest docstring by explicitely stating the splitter strategy used - #27746

Merged
glemaitre merged 7 commits into
scikit-learn:mainfrom
dlhaar:splitting
Nov 8, 2023
Merged

glemaitre merged 7 commits into
scikit-learn:mainfrom
dlhaar:splitting

Conversation

@dlhaar

@dlhaar dlhaar commented Nov 7, 2023

Copy link
Copy Markdown
Contributor

Partially addresses issue #27159

Addressed the first two bullet points of glemaitre's comment

  • added a sentence in the classes RandomForestRegressor and RandomForestClassifier to state that splitter='best' is the splitter setting
  • checked RandomForestRegressor for mentions of classifier but did not find any
  • reconfigured the first sentence in the user guide to make clear how the partition is being made

@betatim @glemaitre

@github-actions

github-actions Bot commented Nov 7, 2023 •

Copy link
Copy Markdown

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 95b240a. Link to the linter CI: here

@glemaitre
glemaitre self-requested a review November 8, 2023 12:24
@glemaitre glemaitre changed the title Edited docstrings to explicitly state and explain splitting strategy DOC improve RandomForest docstring by explicitely stating the splitter strategy used Nov 8, 2023

@glemaitre glemaitre 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.

It looks good. Once the comments are addressed we can merge this PR.

Comment thread sklearn/ensemble/_forest.py Outdated
A random forest is a meta estimator that fits a number of decision tree
classifiers on various sub-samples of the dataset and uses averaging to
improve the predictive accuracy and control over-fitting.
Trees in a forest use the parameter `splitter="best"`.

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.

I would rephrase a bit to not mention the parameter first since this is not in the list of parameter.

Suggested change
Trees in a forest use the parameter `splitter="best"`.
Trees in the forest use the best split strategy, i.e. equivalent to passing `splitter="best"`
to the underlying :class:`~sklearn.tree.DecisionTreeClassifier`.

Comment thread sklearn/ensemble/_forest.py Outdated
A random forest is a meta estimator that fits a number of decision
tree regressors on various sub-samples of the dataset and uses averaging
to improve the predictive accuracy and control over-fitting.
Trees in a forest use the parameter `splitter="best"`.

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.

Suggested change
Trees in a forest use the parameter `splitter="best"`.
Trees in the forest use the best split strategy, i.e. equivalent to passing `splitter="best"`
to the underlying :class:`~sklearn.tree.DecisionTreeRegressor`.

Comment thread doc/modules/ensemble.rst Resolved
Comment thread sklearn/ensemble/_forest.py Outdated
A random forest is a meta estimator that fits a number of decision tree
classifiers on various sub-samples of the dataset and uses averaging to
improve the predictive accuracy and control over-fitting.
Trees in the forest use the best split strategy, i.e. equivalent to passing `splitter="best"`

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.

The linter is failing because this is more than 88 characters. Could your rewrap the sentence.

@dlhaar dlhaar Nov 8, 2023 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Both paragraphs are now fixed.

Comment thread sklearn/ensemble/_forest.py Outdated
tree regressors on various sub-samples of the dataset and uses averaging
to improve the predictive accuracy and control over-fitting.
A random forest is a meta estimator that fits a number of decision tree
classifiers on various sub-samples of the dataset and uses averaging to

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.

Suggested change
classifiers on various sub-samples of the dataset and uses averaging to
regressors on various sub-samples of the dataset and uses averaging to

@glemaitre glemaitre 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.

Thanks @dlhaar LGTM. I am going to enable the auto-merge.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants