Skip to content
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 fixes for SMAPE and R2Score #2771

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 2 additions & 3 deletions src/torchmetrics/regression/r2.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class R2Score(Metric):

where the parameter :math:`k` (the number of independent regressors) should be provided as the `adjusted` argument.
The score is only proper defined when :math:`SS_{tot}\neq 0`, which can happen for near constant targets. In this
case a score of 0 is returned. By definition the score is bounded between 0 and 1, where 1 corresponds to the
predictions exactly matching the targets.
case a score of 0 is returned. By definition the score is bounded between :math:`-inf` and 1.0, with 1.0 indicating
perfect prediction, 0 indicating constant prediction and negative values indicating worse than constant prediction.

As input to ``forward`` and ``update`` the metric accepts the following input:

Expand Down Expand Up @@ -99,7 +99,6 @@ class R2Score(Metric):
is_differentiable: bool = True
higher_is_better: bool = True
full_state_update: bool = False
plot_lower_bound: float = 0.0
plot_upper_bound: float = 1.0

sum_squared_error: Tensor
Expand Down
3 changes: 2 additions & 1 deletion src/torchmetrics/regression/symmetric_mape.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class SymmetricMeanAbsolutePercentageError(Metric):

As output of ``forward`` and ``compute`` the metric returns the following output:

- ``smape`` (:class:`~torch.Tensor`): A tensor with non-negative floating point smape value between 0 and 1
- ``smape`` (:class:`~torch.Tensor`): A tensor with non-negative floating point smape value between 0 and 2

Args:
kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
Expand All @@ -60,6 +60,7 @@ class SymmetricMeanAbsolutePercentageError(Metric):
higher_is_better: bool = False
full_state_update: bool = False
plot_lower_bound: float = 0.0
plot_upper_bound: float = 2.0

sum_abs_per_error: Tensor
total: Tensor
Expand Down
Loading