Skip to content

Added link to plot_adaboost_multiclass.py example #27913

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 21 commits into from
Mar 7, 2024

Conversation

virchan
Copy link
Member

@virchan virchan commented Dec 8, 2023

Reference Issues/PRs

Towards #26927

What does this implement/fix? Explain your changes.

Includes a link to the plot_adaboost_multiclass.py example

Any other comments?

NA

Copy link

github-actions bot commented Dec 8, 2023

✔️ Linting Passed

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

Generated for commit: 03aa44a. Link to the linter CI: here

@marenwestermann
Copy link
Member

Hi @virchan! You added a link to the example in the example itself. The links need to be placed in the doc strings of the functions/ estimators and if applicable the user guide. For an example see PR #26877.

@virchan virchan reopened this Dec 10, 2023
@virchan
Copy link
Member Author

virchan commented Dec 10, 2023

Hello @marenwestermann,

Thank you for the reference, it's really helpful. I've moved the example link from the example itself to the doc string in sklearn\ensemble\_weight_boosting.py.

@@ -351,6 +351,9 @@ class AdaBoostClassifier(

Read more in the :ref:`User Guide <adaboost>`.

For more example of usage, see
Copy link
Member

Choose a reason for hiding this comment

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

It's better to put the reference under the "Examples" section and write something like
For an example of how AdaBoost is used to fit a sequence of Decision Trees, refer to :ref:`sphx_glr_auto_examples_ensemble_plot_adaboost_multiclass.py`.

It would also be good to leave a reference in the doc string of the DecisionTreeClassifier estimator under the "Notes" or "Examples" section.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for writing back!

The following files are modified:

ensemble\_weight_boosting.py: Reworked the example reference and moved it below the Example section.
tree\_classes.py: Added the example reference of using AdaBoost with decision trees for the DecisionTree class.

Please let me know if you need anything else.

`ensemble/_weight_boosting.py` file, moving it below the `Examples`
section for improved organization.

Included an AdaBoost example reference within the DecisionTree class in
the `tree/-class.py` file.
Copy link
Member

@marenwestermann marenwestermann left a comment

Choose a reason for hiding this comment

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

Apologies for the belated reply. I added a small comment (see below). Additionally it would be good to add a link to the example to this section of the user guide which you can find in the code here. Just add the link to this example to the examples that are already listed there.

@@ -478,6 +478,9 @@ class AdaBoostClassifier(
array([1])
>>> clf.score(X, y)
0.96...

For an example of using AdaBoost to fit a sequence of DecisionTrees as weak learners,
Copy link
Member

Choose a reason for hiding this comment

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

I just realised that if estimator=None as is the case here, the base estimator is DecisionTreeClassifier. So it would be better to write For a detailed example ... .

…sion Trees user guide.

- Modified the doc-string wording in the `AdaBoostClassifier` class referencing to the aforementioned example.
@virchan virchan reopened this Feb 28, 2024
@virchan
Copy link
Member Author

virchan commented Feb 28, 2024

Thank you for the reply. I have updated the following files:

  • sklearn\ensemble\_weight_boosting.py: Corrected the doc-string referencing to the Adaboost example.
  • doc\modules\tree.rst: Added the Adaboost example to the Decision Trees user guide.
  • sklearn/tree/_classes: Added the Adaboost example to the DecisionTreeClassifier doc-string.

Please let me know if I missed anything.

@marenwestermann
Copy link
Member

Thank you for the update @virchan. Can you fix the linting issue? When you click on the details under "ci/circleci: lint" in the code checks you'll see the error messages.

@virchan
Copy link
Member Author

virchan commented Mar 2, 2024

Thank you for the follow-up!

The linting issue is fixed, all checks have passed.

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.

Otherwise LGTM.

Comment on lines +482 to +484
For a detailed example of using AdaBoost to fit a sequence of DecisionTrees
as weaklearners, please refer to
:ref:`sphx_glr_auto_examples_ensemble_plot_adaboost_multiclass.py`.
Copy link
Member

Choose a reason for hiding this comment

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

I think this is the only place where the mention makes sense. I would then remove the other two mentions in this PR.

@virchan
Copy link
Member Author

virchan commented Mar 6, 2024

Hello,

Thank you for the feedback! The example references are removed from the doc\modules\tree.rst and the sklearn/tree/_classes.py files.

Please let me know if there is anything else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants