Skip to content

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

Merged
adrinjalali merged 5 commits intoscikit-learn:mainfrom
Siniade:link-to-example
Feb 12, 2025
Merged

DOC added links to plot_gradient_boosting_regularization.py and plot_gradient_boosting_categorical.py#30749
adrinjalali merged 5 commits intoscikit-learn:mainfrom
Siniade:link-to-example

Conversation

@Siniade
Copy link
Copy Markdown
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?

@github-actions
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
29 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