Skip to content

Commit

Permalink
links
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda committed Feb 6, 2023
1 parent 0e16392 commit a6cd44f
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions docs/source/links.rst
Expand Up @@ -64,10 +64,10 @@
.. _Improved Techniques for Training GANs: https://arxiv.org/abs/1606.03498
.. _KID Score: https://github.com/toshas/torch-fidelity/blob/v0.3.0/torch_fidelity/metric_kid.py
.. _Demystifying MMD GANs: https://arxiv.org/abs/1801.01401
.. _Computes Peak Signal-to-Noise Ratio: https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio
.. _Compute Peak Signal-to-Noise Ratio: https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio
.. _Turn a Metric into a Bootstrapped: https://en.wikipedia.org/wiki/Bootstrapping_(statistics)
.. _Metric Test for Reset: https://github.com/Lightning-AI/pytorch-lightning/pull/7055
.. _Computes Mean Absolute Error: https://en.wikipedia.org/wiki/Mean_absolute_error
.. _Compute Mean Absolute Error: https://en.wikipedia.org/wiki/Mean_absolute_error
.. _Mean Absolute Percentage Error: https://en.wikipedia.org/wiki/Mean_absolute_percentage_error
.. _mean squared error: https://en.wikipedia.org/wiki/Mean_squared_error
.. _Aggregate the statistics from multiple devices: https://stackoverflow.com/questions/68395368/estimate-running-correlation-on-multiple-nodes
Expand Down
40 changes: 20 additions & 20 deletions src/torchmetrics/classification/accuracy.py
Expand Up @@ -32,7 +32,7 @@


class BinaryAccuracy(BinaryStatScores):
r"""Computes `Accuracy`_ for binary tasks:
r"""Compute `Accuracy`_ for binary tasks.
.. math::
\text{Accuracy} = \frac{1}{N}\sum_i^N 1(y_i = \hat{y}_i)
Expand All @@ -41,16 +41,16 @@ class BinaryAccuracy(BinaryStatScores):
As input to ``forward`` and ``update`` the metric accepts the following input:
- ``preds`` (:class:`~torch.Tensor`): An int or float tensor of shape ``(N, ...)``. If preds is a floating
point tensor with values outside [0,1] range we consider the input to be logits and will auto apply sigmoid
per element. Addtionally, we convert to int tensor with thresholding using the value in ``threshold``.
- ``target`` (:class:`~torch.Tensor`): An int tensor of shape ``(N, ...)``
- ``preds`` (:class:`~torch.Tensor`): An int or float tensor of shape ``(N, ...)``. If preds is a floating
point tensor with values outside [0,1] range we consider the input to be logits and will auto apply sigmoid
per element. Addtionally, we convert to int tensor with thresholding using the value in ``threshold``.
- ``target`` (:class:`~torch.Tensor`): An int tensor of shape ``(N, ...)``
As output to ``forward`` and ``compute`` the metric returns the following output:
- ``ba`` (:class:`~torch.Tensor`): If ``multidim_average`` is set to ``global``, the metric returns a scalar value.
If ``multidim_average`` is set to ``samplewise``, the metric returns ``(N,)`` vector consisting of a scalar
value per sample.
- ``ba`` (:class:`~torch.Tensor`): If ``multidim_average`` is set to ``global``, metric returns a scalar value.
If ``multidim_average`` is set to ``samplewise``, the metric returns ``(N,)`` vector consisting of a scalar
value per sample.
Args:
threshold: Threshold for transforming probability to binary {0,1} predictions
Expand Down Expand Up @@ -161,25 +161,25 @@ class MulticlassAccuracy(MulticlassStatScores):
As input to ``forward`` and ``update`` the metric accepts the following input:
- ``preds`` (:class:`~torch.Tensor`): An int tensor of shape ``(N, ...)`` or float tensor of shape ``(N, C, ..)``.
If preds is a floating point we apply ``torch.argmax`` along the ``C`` dimension to automatically convert
probabilities/logits into an int tensor.
- ``target`` (:class:`~torch.Tensor`): An int tensor of shape ``(N, ...)``
- ``preds`` (:class:`~torch.Tensor`): An int tensor of shape ``(N, ...)`` or float tensor
of shape ``(N, C, ..)``. If preds is a floating point we apply ``torch.argmax`` along the ``C`` dimension
to automatically convert probabilities/logits into an int tensor.
- ``target`` (:class:`~torch.Tensor`): An int tensor of shape ``(N, ...)``
As output to ``forward`` and ``compute`` the metric returns the following output:
- ``mca`` (:class:`~torch.Tensor`): A tensor with the accuracy score whose returned shape depends on the
``average`` and ``multidim_average`` arguments:
- ``mca`` (:class:`~torch.Tensor`): A tensor with the accuracy score whose returned shape depends on the
``average`` and ``multidim_average`` arguments:
- If ``multidim_average`` is set to ``global``:
- If ``multidim_average`` is set to ``global``:
- If ``average='micro'/'macro'/'weighted'``, the output will be a scalar tensor
- If ``average=None/'none'``, the shape will be ``(C,)``
- If ``average='micro'/'macro'/'weighted'``, the output will be a scalar tensor
- If ``average=None/'none'``, the shape will be ``(C,)``
- If ``multidim_average`` is set to ``samplewise``:
- If ``multidim_average`` is set to ``samplewise``:
- If ``average='micro'/'macro'/'weighted'``, the shape will be ``(N,)``
- If ``average=None/'none'``, the shape will be ``(N, C)``
- If ``average='micro'/'macro'/'weighted'``, the shape will be ``(N,)``
- If ``average=None/'none'``, the shape will be ``(N, C)``
Args:
num_classes: Integer specifing the number of classes
Expand Down
8 changes: 4 additions & 4 deletions src/torchmetrics/functional/image/psnr.py
Expand Up @@ -27,7 +27,7 @@ def _psnr_compute(
base: float = 10.0,
reduction: Literal["elementwise_mean", "sum", "none", None] = "elementwise_mean",
) -> Tensor:
"""Computes peak signal-to-noise ratio.
"""Compute peak signal-to-noise ratio.
Args:
sum_squared_error: Sum of square of errors over all observations
Expand Down Expand Up @@ -60,13 +60,13 @@ def _psnr_update(
target: Tensor,
dim: Optional[Union[int, Tuple[int, ...]]] = None,
) -> Tuple[Tensor, Tensor]:
"""Updates and returns variables required to compute peak signal-to-noise ratio.
"""Update and return variables required to compute peak signal-to-noise ratio.
Args:
preds: Predicted tensor
target: Ground truth tensor
dim: Dimensions to reduce PSNR scores over provided as either an integer or a list of integers. Default is
None meaning scores will be reduced across all dimensions.
dim: Dimensions to reduce PSNR scores over provided as either an integer or a list of integers.
Default is None meaning scores will be reduced across all dimensions.
"""

if dim is None:
Expand Down
4 changes: 2 additions & 2 deletions src/torchmetrics/functional/regression/mae.py
Expand Up @@ -37,7 +37,7 @@ def _mean_absolute_error_update(preds: Tensor, target: Tensor) -> Tuple[Tensor,


def _mean_absolute_error_compute(sum_abs_error: Tensor, n_obs: int) -> Tensor:
"""Computes Mean Absolute Error.
"""Compute Mean Absolute Error.
Args:
sum_abs_error: Sum of absolute value of errors over all observations
Expand All @@ -55,7 +55,7 @@ def _mean_absolute_error_compute(sum_abs_error: Tensor, n_obs: int) -> Tensor:


def mean_absolute_error(preds: Tensor, target: Tensor) -> Tensor:
"""Computes mean absolute error.
"""Compute mean absolute error.
Args:
preds: estimated labels
Expand Down
2 changes: 1 addition & 1 deletion src/torchmetrics/image/psnr.py
Expand Up @@ -23,7 +23,7 @@


class PeakSignalNoiseRatio(Metric):
r"""Computes `Computes Peak Signal-to-Noise Ratio`_ (PSNR):
r"""`Compute Peak Signal-to-Noise Ratio`_ (PSNR):
.. math:: \text{PSNR}(I, J) = 10 * \log_{10} \left(\frac{\max(I)^2}{\text{MSE}(I, J)}\right)
Expand Down
4 changes: 2 additions & 2 deletions src/torchmetrics/regression/mae.py
Expand Up @@ -20,7 +20,7 @@


class MeanAbsoluteError(Metric):
r"""`Computes Mean Absolute Error`_ (MAE):
r"""`Compute Mean Absolute Error`_ (MAE):
.. math:: \text{MAE} = \frac{1}{N}\sum_i^N | y_i - \hat{y_i} |
Expand Down Expand Up @@ -70,5 +70,5 @@ def update(self, preds: Tensor, target: Tensor) -> None: # type: ignore
self.total += n_obs

def compute(self) -> Tensor:
"""Computes mean absolute error over state."""
"""Compute mean absolute error over state."""
return _mean_absolute_error_compute(self.sum_abs_error, self.total)

0 comments on commit a6cd44f

Please sign in to comment.