Skip to content

DOC: clarify verbose behavior in GridSearchCV and RandomizedSearchCV - #32968

Merged
StefanieSenger merged 7 commits into
scikit-learn:mainfrom
anandvenugopal-tech:docs-gridsearch-verbose
Jan 7, 2026
Merged

StefanieSenger merged 7 commits into
scikit-learn:mainfrom
anandvenugopal-tech:docs-gridsearch-verbose

Conversation

@anandvenugopal-tech

Copy link
Copy Markdown
Contributor

This PR clarifies the behavior of the verbose parameter in
GridSearchCV and RandomizedSearchCV.

The documentation now:

  • Explicitly documents the behavior when verbose=0
  • Clarifies what additional information is shown as verbosity increases
  • Notes that higher verbosity levels (e.g. >10) may produce additional
    progress messages depending on the execution backend

This aligns the documentation with the observed behavior discussed in
#32946.

Reference Issues/PRs

What does this implement/fix? Explain your changes.

AI usage disclosure

I used AI assistance for:

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Any other comments?

@anandvenugopal-tech

Copy link
Copy Markdown
Contributor Author

This PR only updates documentation.

The CI failures appear unrelated to the changes here.
Happy to rebase or adjust if needed.

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

Hi @anandvenugopal-tech,

thanks for the PR. The CI failures are related to this PR. Please use pre-commit (as described in the development guide) to fix the linting issues and then push again.

@github-actions github-actions Bot removed the CI:Linter failure The linter CI is failing on this PR label Dec 29, 2025
@anandvenugopal-tech

Copy link
Copy Markdown
Contributor Author

Thanks for the review.
All requested changes have been addressed, and all CI checks are now passing.
Please let me know if anything else is needed.

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

Thanks, @anandvenugopal-tech. I have pushed a little wording tweak to make it all a bit shorter: I have also added a line on verbosity=1 which had not been mentioned and also I have seen that parameter candidate indices are only printed from verbosity=10 on , which I found worth mentioning. Approving this PR.

@anandvenugopal-tech

Copy link
Copy Markdown
Contributor Author

Thanks for the updates and the review!
Everything looks good to me now. Happy to adjust further if needed.

@StefanieSenger StefanieSenger added the Waiting for Second Reviewer First reviewer is done, need a second one! label Jan 2, 2026
@Gabriel-Kissin

Copy link
Copy Markdown

Thanks @StefanieSenger and @anandvenugopal-tech, all looks good to me too, thanks for your time on this :-)

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

Just some nits.

Comment thread sklearn/model_selection/_search.py Outdated
verbose : int
Controls the verbosity: the higher, the more messages.
verbose : int, default=0
Controls the verbosity of the grid search.

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.

What about:

Suggested change
Controls the verbosity of the grid search.
Controls the verbosity of information printed during fitting, with higher
values yielding more detailed logging.

"of the grid search" seems a bit redundant as this is the docstring for gridsearch. We can then get rid of the next sentence.

@StefanieSenger StefanieSenger Jan 7, 2026 •

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! I agree.
I have gone and modified this @anandvenugopal-tech.

Comment on lines +1369 to +1372
- >=1 : summary of the total number of fits;
- >=2 : computation time for each fold and parameter candidate;
- >=3 : fold indices and scores;
- >=10 : parameter candidate indices and START messages before each fit.

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.

Just a question, are the logs for verbosity between 3 and 10 (e.g., 3,4,5), different? And similar question for values greater than 10, is there more information or does any number greater than 10 give the same information?

I also wonder if we should add 'includes' or 'also' (like the previous docs) to make it clear that the previous information is included as well as the the new item.

@StefanieSenger StefanieSenger Jan 7, 2026 •

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.

Just a question, are the logs for verbosity between 3 and 10 (e.g., 3,4,5), different? And similar question for values greater than 10, is there more information or does any number greater than 10 give the same information?

From 3 to 9, as well as above 10, it is all the same information.

I also wonder if we should add 'includes' or 'also' (like the previous docs) to make it clear that the previous information is included as well as the the new item.

We had this at first, but I then decided to go with >=number meaning "every verbosity larger than number displays this information".

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

LGTM thanks. @StefanieSenger feel free to merge (when you're happy).

@StefanieSenger

Copy link
Copy Markdown
Member

Merging, thanks a lot @anandvenugopal-tech and everyone involved! 🎉

@StefanieSenger
StefanieSenger merged commit 8a59044 into scikit-learn:main Jan 7, 2026
@anandvenugopal-tech
anandvenugopal-tech deleted the docs-gridsearch-verbose branch January 7, 2026 14:00
@anandvenugopal-tech

Copy link
Copy Markdown
Contributor Author

Thanks a lot for the review and merge!
Really appreciate the guidance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants