Skip to content

Commit

Permalink
Merge branch 'master' into r2_move_error
Browse files Browse the repository at this point in the history
  • Loading branch information
SkafteNicki authored Aug 4, 2021
2 parents 25c3de9 + ad9845b commit 9e40f98
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions torchmetrics/functional/regression/r2.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ def r2_score(
r"""
Computes r2 score also known as `coefficient of determination`_:
.. math:: R^2 = 1 - \frac{SS_res}{SS_tot}
.. math:: R^2 = 1 - \frac{SS_{res}}{SS_{tot}}
where :math:`SS_res=\sum_i (y_i - f(x_i))^2` is the sum of residual squares, and
:math:`SS_tot=\sum_i (y_i - \bar{y})^2` is total sum of squares. Can also calculate
where :math:`SS_{res}=\sum_i (y_i - f(x_i))^2` is the sum of residual squares, and
:math:`SS_{tot}=\sum_i (y_i - \bar{y})^2` is total sum of squares. Can also calculate
adjusted r2 score given by
.. math:: R^2_adj = 1 - \frac{(1-R^2)(n-1)}{n-k-1}
.. math:: R^2_{adj} = 1 - \frac{(1-R^2)(n-1)}{n-k-1}
where the parameter :math:`k` (the number of independent regressors) should
be provided as the ``adjusted`` argument.
Expand Down
8 changes: 4 additions & 4 deletions torchmetrics/regression/r2.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ class R2Score(Metric):
r"""
Computes r2 score also known as `coefficient of determination`_:
.. math:: R^2 = 1 - \frac{SS_res}{SS_tot}
.. math:: R^2 = 1 - \frac{SS_{res}}{SS_{tot}}
where :math:`SS_res=\sum_i (y_i - f(x_i))^2` is the sum of residual squares, and
:math:`SS_tot=\sum_i (y_i - \bar{y})^2` is total sum of squares. Can also calculate
where :math:`SS_{res}=\sum_i (y_i - f(x_i))^2` is the sum of residual squares, and
:math:`SS_{tot}=\sum_i (y_i - \bar{y})^2` is total sum of squares. Can also calculate
adjusted r2 score given by
.. math:: R^2_adj = 1 - \frac{(1-R^2)(n-1)}{n-k-1}
.. math:: R^2_{adj} = 1 - \frac{(1-R^2)(n-1)}{n-k-1}
where the parameter :math:`k` (the number of independent regressors) should
be provided as the `adjusted` argument.
Expand Down

0 comments on commit 9e40f98

Please sign in to comment.