Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

DOC added links to plot_gradient_boosting_regularization.py and plot_gradient_boosting_categorical.py #30749

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 12, 2025

Conversation

Siniade
Copy link
Contributor

@Siniade Siniade commented Feb 2, 2025

Reference Issues/PRs

Towards #30621 - Linked examples for plot_gradient_boosting_categorical.py, plot_gradient_boosting_oob.py, and plot_gradient_boosting_regularization.py from examples/ensemble.

What does this implement/fix? Explain your changes.

plot_gradient_boosting_categorical.py

  • Added description to the API documentation in sklearn.ensemble.HistGradientBoostingRegressor
  • No changes to User Guide - already well referenced under 1.11.1.1.4

plot_gradient_boosting_oob.py

  • Added description to the API documentation in sklearn.ensemble.GradientBoostingClassifier
  • No changes to User Guide - already well referenced under 1.11.1.2 & 1.11.1.2.6

plot_gradient_boosting_regularization.py

  • Added description to the API documentation in sklearn.ensemble.GradientBoostingClassifier & sklearn.ensemble.GradientBoostingRegressor
  • Referenced under Examples in 1.11.1.2.6. Added a link to the example in the text under 1.11.1.2.5.

Any other comments?

Copy link

github-actions bot commented Feb 2, 2025

✔️ Linting Passed

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

Generated for commit: d95548d. Link to the linter CI: here

Copy link
Member

@virchan virchan left a comment

Choose a reason for hiding this comment

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

Thank you for the PR @Siniade!

I have a few comments:

Comment on lines 1749 to 1751
See :ref:`sphx_glr_auto_examples_ensemble_plot_gradient_boosting_regularization.py`
for an example on using regularization with Gradient Boosting.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need this example here since the linked resource is about classifiers, whereas the docstring refers to a regressor. The relevant example is already covered by plot_gradient_boosting_regression.py, which is included in the docstring of GradientBoostingRegressor.

Comment on lines 1136 to 1142
See :ref:`sphx_glr_auto_examples_ensemble_plot_gradient_boosting_oob.py` for
an example on using Out-of-Bag estimates to estimate the optimal number of
iterations for Gradient Boosting.
See
:ref:`sphx_glr_auto_examples_ensemble_plot_gradient_boosting_regularization.py`
for an example on using regularization with Gradient Boosting.

Copy link
Member

Choose a reason for hiding this comment

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

Could you please move these two examples to the end of the docstring? You can refer to how plot_gradient_boosting_regression.py is placed in the GradientBoostingRegressor docstring.

Comment on lines 1423 to 1426
See :ref:`sphx_glr_auto_examples_ensemble_plot_hgbt_regression.py` for a
usecase example of this feature.
usecase example of this feature. See
:ref:`sphx_glr_auto_examples_ensemble_plot_gradient_boosting_categorical.py`
for an example using histogram-based gradient boosting on categorical features.
Copy link
Member

Choose a reason for hiding this comment

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

Would you mind placing these two examples at the end of the docstring? You can follow the placement of plot_gradient_boosting_regression.py in the GradientBoostingRegressor docstring as a reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. The first example was already present and is related to the paragraph that precedes it. Do you want me to move the first examples also in that case or should I let that be?

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the catch! You can leave the first example where it is.

@Siniade
Copy link
Contributor Author

Siniade commented Feb 4, 2025

Thank you for the PR @Siniade!

I have a few comments:

Thanks for your suggestions! I have made the updates

Copy link
Member

@virchan virchan left a comment

Choose a reason for hiding this comment

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

Thank you for updating the PR @Siniade!

I have a few more comments.

Comment on lines 1457 to 1460
iterations for Gradient Boosting. For a detailed example of utilizing
regularization with
:class:`~sklearn.ensemble.GradientBoostingClassifier`, please refer to
:ref:`sphx_glr_auto_examples_ensemble_plot_gradient_boosting_regularization.py`.
Copy link
Member

Choose a reason for hiding this comment

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

Could you please separate this example into a new paragraph?

Comment on lines 822 to 823
``learning_rate`` and ``n_estimators`` see [R2007]_. Also see :ref:`sphx_glr_auto_examples_ensemble_plot_gradient_boosting_regularization.py`
for an example on how regularization via shrinkage impacts Gradient Boosting.
Copy link
Member

Choose a reason for hiding this comment

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

Could you please move

"Also see :ref:sphx_glr_auto_examples_ensemble_plot_gradient_boosting_regularization.py"

to the next line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. I have committed the updated changes.

Copy link
Member

@virchan virchan left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @Siniade!

@adrinjalali, @marenwestermann, would you like to take a look and merge it?

Copy link
Member

@adrinjalali adrinjalali left a comment

Choose a reason for hiding this comment

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

I've applied my comments directly here. Thanks for the PR @Siniade

Comment on lines 824 to 825
Also see :ref:`sphx_glr_auto_examples_ensemble_plot_gradient_boosting_regularization.py`
for an example on how regularization via shrinkage impacts Gradient Boosting.
Copy link
Member

Choose a reason for hiding this comment

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

already mentioned in the next section, so removing

Comment on lines 1459 to 1461
For a detailed example of utilizing regularization with
:class:`~sklearn.ensemble.GradientBoostingClassifier`, please refer to
:ref:`sphx_glr_auto_examples_ensemble_plot_gradient_boosting_regularization.py`.
Copy link
Member

Choose a reason for hiding this comment

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

moving this to the parameter docstring

Comment on lines 1455 to 1457
See :ref:`sphx_glr_auto_examples_ensemble_plot_gradient_boosting_oob.py` for
an example on using Out-of-Bag estimates to estimate the optimal number of
iterations for Gradient Boosting.
Copy link
Member

Choose a reason for hiding this comment

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

this example is linked from the user guide, and needs improvements, then we can think of adding it in the docstring, so removing it from here

Comment on lines 1668 to 1669
See :ref:`sphx_glr_auto_examples_ensemble_plot_gradient_boosting_categorical.py`
for an example using histogram-based gradient boosting on categorical features.
Copy link
Member

Choose a reason for hiding this comment

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

moving to the parameter's docstring.

@adrinjalali adrinjalali changed the title Linked 3 examples to the User Guide and API documentation DOC added links to plot_gradient_boosting_regularization.py and plot_gradient_boosting_categorical.py Feb 12, 2025
@adrinjalali adrinjalali enabled auto-merge (squash) February 12, 2025 15:57
@adrinjalali adrinjalali merged commit f93ff1b into scikit-learn:main Feb 12, 2025
34 checks passed
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.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.