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
DOC Add examples of make_scorer usage to fbeta_score docstring #28755
base: main
Are you sure you want to change the base?
DOC Add examples of make_scorer usage to fbeta_score docstring #28755
Conversation
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Guillaume Lemaitre <guillaume@probabl.ai>
I realized in a rush I messed up and created the new branch from the old branch rather than main. I'm happy to close this and create a new cleaner PR if you prefer, so as not to pollute it with other commits. |
It is fine to revert the changes that are already done in #28750. Don't worry about the commit history because we are squashing all the history in a single commit and use the title of the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another pass of feedback.
value to minimize, the lower the better. When converting | ||
into a scorer object using :func:`make_scorer`, set | ||
the ``greater_is_better`` parameter to ``False`` (``True`` by default; see the | ||
parameter description below). | ||
|
||
Metrics available for various machine learning tasks are detailed in sections | ||
below. | ||
|
||
Many metrics are not given names to be used as ``scoring`` values, | ||
sometimes because they require additional parameters, such as | ||
:func:`fbeta_score`. In such cases, you need to generate an appropriate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To remove those unwanted changes from this branch, you can try:
git checkout main -- doc/modules/model_evaluation.rst
and commit and push the results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marijavlajic have you tried the above command? Doesn't it work as expected? It would be good to disantangle the contents from this PR from #28750.
Please update the title of the PR to be explicit that this is a bout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpicks but otherwise LGTM!
F-beta score is not implemented as a named scorer that can be | ||
passed to the `scoring` parameter directly; :func:`make_scorer` | ||
needs to be used first instead to create a callable object to then | ||
pass to the `scoring` parameter, see examples for details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F-beta score is not implemented as a named scorer that can be | |
passed to the `scoring` parameter directly; :func:`make_scorer` | |
needs to be used first instead to create a callable object to then | |
pass to the `scoring` parameter, see examples for details. | |
F-beta score is not implemented as a named scorer that can be passed to | |
the `scoring` parameter of cross-validation tools directly: it requires to be | |
wrapped with :func:`make_scorer` so as to specify the value of `beta`. See | |
examples for details. |
>>> grid = GridSearchCV(LinearSVC(dual="auto"), param_grid={'C': [1, 10]}, | ||
... scoring=ftwo_scorer, cv=5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's follow the black formatting conventions in our docstrings as well (even if it was not always the case in the past.
>>> grid = GridSearchCV(LinearSVC(dual="auto"), param_grid={'C': [1, 10]}, | |
... scoring=ftwo_scorer, cv=5) | |
>>> grid = GridSearchCV( | |
... LinearSVC(dual="auto"), | |
... param_grid={'C': [1, 10]}, | |
... scoring=ftwo_scorer, | |
... cv=5, | |
... ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to update the multiline call to fbeta_score
in the previous example snippet to follow the same format style.
Reference Issues/PRs
Related to #28671
What does this implement/fix? Explain your changes.
PR adds examples of make_scorer usage to docstrings of those metrics functions that cannot be passed to the scoring parameter directly and need to instead first be passed to make_scorer to create callable scorer objects.
Any other comments?
This commit only contains the change for fbeta_score / classification metrics. If the format and content are fine, I will add the four regression metrics functions as well.