Skip to content

DOC Add dropdowns to User Guide section 3.2, "Tuning the hyper-parameters of an estimator"#27631

Merged
ArturoAmorQ merged 12 commits intoscikit-learn:mainfrom
jeromedockes:dropdown-in-gridsearch-user-guide
Sep 5, 2024
Merged

DOC Add dropdowns to User Guide section 3.2, "Tuning the hyper-parameters of an estimator"#27631
ArturoAmorQ merged 12 commits intoscikit-learn:mainfrom
jeromedockes:dropdown-in-gridsearch-user-guide

Conversation

@jeromedockes
Copy link
Copy Markdown
Contributor

@jeromedockes jeromedockes commented Oct 20, 2023

Reference Issues/PRs

closes #26617

What does this implement/fix? Explain your changes.

as described in #26617, shorten this section of the user guide by folding some parts in <details>

Any other comments?

@jeromedockes jeromedockes changed the title Add dropdowns to User Guide section 3.2, "Tuning the hyper-parameters of an estimator" [WIP] Add dropdowns to User Guide section 3.2, "Tuning the hyper-parameters of an estimator" Oct 20, 2023
@jeromedockes jeromedockes marked this pull request as draft October 20, 2023 15:10
@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 20, 2023

✔️ Linting Passed

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

Generated for commit: 45aa61a. Link to the linter CI: here

amount of flexibility in identifying the "best" estimator. This interface
can also be used in multiple metrics evaluation.
- See
:ref:`sphx_glr_auto_examples_model_selection_plot_grid_search_refit_callable.py`
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.

those 2 examples seem to showcase very similar functionality

(or `=np.nan`) will make the procedure robust to such failure, issuing a
warning and setting the score for that fold to 0 (or `nan`), but completing
the search.
Some parameter settings may result in a failure to ``fit`` one or more folds of
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.

This is not related to dropdowns but that part appears to be outdated as error_score=np.nan is now the default; LMK if it should be handled in another issue & pr instead

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.

Nice catch! I think it's ok to address the issue here.

@jeromedockes jeromedockes changed the title [WIP] Add dropdowns to User Guide section 3.2, "Tuning the hyper-parameters of an estimator" [WIP] DOC Add dropdowns to User Guide section 3.2, "Tuning the hyper-parameters of an estimator" Oct 20, 2023
@jeromedockes jeromedockes marked this pull request as ready for review October 31, 2023 08:14
@jeromedockes jeromedockes changed the title [WIP] DOC Add dropdowns to User Guide section 3.2, "Tuning the hyper-parameters of an estimator" DOC Add dropdowns to User Guide section 3.2, "Tuning the hyper-parameters of an estimator" Oct 31, 2023
Copy link
Copy Markdown
Member

@ArturoAmorQ ArturoAmorQ left a comment

Choose a reason for hiding this comment

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

Thanks for your time and work @jeromedockes, I like your approach for using dropdowns. The only issue here is that they break the sphinx references (such as .. _amount_of_resource_and_number_of_candidates: in line 295). One can still use permalinks as introduced in #27409, but then we rather hide one subsection of 3.2.3 Searching for optimal parameters with successive halving at the time, or WDYT?

(or `=np.nan`) will make the procedure robust to such failure, issuing a
warning and setting the score for that fold to 0 (or `nan`), but completing
the search.
Some parameter settings may result in a failure to ``fit`` one or more folds of
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.

Nice catch! I think it's ok to address the issue here.

@jeromedockes
Copy link
Copy Markdown
Contributor Author

jeromedockes commented Nov 30, 2023

The only issue here is that they break the sphinx references

Sorry I missed that!
I think I did not realize because they work when the <details> is expanded, and AFAICT all the references are in the same section so to see/click the links that stop working when we collapse the section we have to expand it

One can still use permalinks as introduced in #27409, but then we rather hide one subsection of 3.2.3 Searching for optimal parameters with successive halving at the time, or WDYT?

That sounds better. It might be a bit awkward to have 6 collapsed sections in a row, but better than breaking the references.
As there is so much information about successive halving and these sections have 3 levels of nesting (3.2.3.1-6), we could also consider having a dedicated page just for successive halving?

@jeromedockes
Copy link
Copy Markdown
Contributor Author

One can still use permalinks as introduced in #27409, but then we rather hide one subsection of 3.2.3 Searching for optimal parameters with successive halving at the time, or WDYT?

AFAICT the ids added in #27409 are added with javascript when the page is rendered. if we use those anchors does that mean I should replace sphinx references with hyperlinks? one drawback is I guess those will not be checked by sphinx

note here the situation is a bit different than #27408 because when the anchor is also inside the <details>, sphinx does create the reference -- but following the link does not automatically expand the section

@ArturoAmorQ
Copy link
Copy Markdown
Member

ArturoAmorQ commented Jan 22, 2024

That sounds better. It might be a bit awkward to have 6 collapsed sections in a row, but better than breaking the references.

I don't think it is that awkward, we have 3 collapsed sections in a row in the Contributing Guide. If you find it pertinent, maybe we can keep a short intro to each subsection before hiding the rest in a dropdown. This would solve the problem with the hyperlinks.

@ArturoAmorQ
Copy link
Copy Markdown
Member

👀

Copy link
Copy Markdown
Member

@ArturoAmorQ ArturoAmorQ left a comment

Choose a reason for hiding this comment

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

Thanks for reviving this PR! Just a couple of comments :)

:ref:`exhausting_the_resources` for details.
|details-end|

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

We will have to use a permalink to replace this cross-reference. Happily it is only referenced from this rst file.

.. _amount_of_resource_and_number_of_candidates:

|details-start|
Amount of resource and number of candidates at each iteration
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.

Maybe just a nit, but we can try to use bold titles for the dropdowns.

@glemaitre
Copy link
Copy Markdown
Member

@jeromedockes Could you finish this PR. This is actually the last one from the meta issue and then we can close ;)

@jeromedockes
Copy link
Copy Markdown
Contributor Author

jeromedockes commented May 17, 2024 via email

@glemaitre
Copy link
Copy Markdown
Member

glemaitre commented May 17, 2024

Sorry about that! I'll finish it on Wednesday at the latest.

No worries, I was just doing some book keeping and just saw that it was the last issue. Take your time to solve this PR, there is no rush.

Copy link
Copy Markdown
Member

@ArturoAmorQ ArturoAmorQ left a comment

Choose a reason for hiding this comment

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

I hope after these comments are addressed, this PR should be good to go.

Copy link
Copy Markdown
Member

@ArturoAmorQ ArturoAmorQ left a comment

Choose a reason for hiding this comment

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

LGTM. Let's merge and iterate over time if needed. Thanks @jeromedockes!

@ArturoAmorQ ArturoAmorQ merged commit 390ce98 into scikit-learn:main Sep 5, 2024
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Sep 9, 2024
glemaitre pushed a commit that referenced this pull request Sep 11, 2024
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.

DOC Introduce dropdowns in the User Guide

3 participants