Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[DOC] Use math mode in r2_score function #19921

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 2 commits into from
Apr 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions 10 sklearn/metrics/_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,12 +670,12 @@ def explained_variance_score(y_true, y_pred, *,
@_deprecate_positional_args
def r2_score(y_true, y_pred, *, sample_weight=None,
multioutput="uniform_average"):
"""R^2 (coefficient of determination) regression score function.
""":math:`R^2` (coefficient of determination) regression score function.

Best possible score is 1.0 and it can be negative (because the
model can be arbitrarily worse). A constant model that always
predicts the expected value of y, disregarding the input features,
would get a R^2 score of 0.0.
would get a :math:`R^2` score of 0.0.

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

Expand Down Expand Up @@ -713,15 +713,15 @@ def r2_score(y_true, y_pred, *, sample_weight=None,
Returns
-------
z : float or ndarray of floats
The R^2 score or ndarray of scores if 'multioutput' is
The :math:`R^2` score or ndarray of scores if 'multioutput' is
'raw_values'.

Notes
-----
This is not a symmetric function.

Unlike most other scores, R^2 score may be negative (it need not actually
be the square of a quantity R).
Unlike most other scores, :math:`R^2` score may be negative (it need not
actually be the square of a quantity R).

This metric is not well-defined for single samples and will return a NaN
value if n_samples is less than two.
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.