Skip to content

Added link to plot_adaboost_multiclass.py example - #27913

Merged
adrinjalali merged 21 commits into
scikit-learn:mainfrom
virchan:main
Mar 7, 2024
Merged

adrinjalali merged 21 commits into
scikit-learn:mainfrom
virchan:main

Conversation

@virchan

@virchan virchan commented Dec 8, 2023

Copy link
Copy Markdown
Member

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

@github-actions

github-actions Bot commented Dec 8, 2023 •

Copy link
Copy Markdown

✔️ 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
Copy Markdown
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

virchan commented Dec 10, 2023 •

Copy link
Copy Markdown
Member Author

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.

Comment thread sklearn/ensemble/_weight_boosting.py Outdated

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

For more example of usage, see

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'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
Copy Markdown
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.

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

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.

Comment thread sklearn/ensemble/_weight_boosting.py Outdated
>>> clf.score(X, y)
0.96...

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

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

@virchan virchan reopened this Feb 28, 2024
@virchan

virchan commented Feb 28, 2024 •

Copy link
Copy Markdown
Member Author

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

virchan commented Mar 2, 2024

Copy link
Copy Markdown
Member Author

Thank you for the follow-up!

The linting issue is fixed, all checks have passed.

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

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

virchan commented Mar 6, 2024

Copy link
Copy Markdown
Member Author

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