Skip to content

Commit

Permalink
fix doc linking
Browse files Browse the repository at this point in the history
  • Loading branch information
SkafteNicki committed Oct 12, 2022
1 parent 826c937 commit c35620f
Show file tree
Hide file tree
Showing 14 changed files with 51 additions and 111 deletions.
13 changes: 3 additions & 10 deletions src/torchmetrics/classification/accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,6 @@ class Accuracy(StatScores):
changed to subset accuracy (which requires all labels or sub-samples in the sample to
be correctly predicted) by setting ``subset_accuracy=True``.
Accepts all input types listed in :ref:`pages/classification:input types`.
Args:
num_classes:
Number of classes. Necessary for ``'macro'``, ``'weighted'`` and ``None`` average methods.
Expand Down Expand Up @@ -387,11 +385,10 @@ class Accuracy(StatScores):
- ``'samplewise'``: In this case, the statistics are computed separately for each
sample on the ``N`` axis, and then averaged over samples.
The computation for each sample is done by treating the flattened extra axes ``...``
(see :ref:`pages/classification:input types`) as the ``N`` dimension within the sample,
as the ``N`` dimension within the sample,
and computing the metric for the sample based on that.
- ``'global'``: In this case the ``N`` and ``...`` dimensions of the inputs
(see :ref:`pages/classification:input types`)
are flattened into a new ``N_X`` sample axis, i.e. the inputs are treated as if they
were ``(N_X, C)``. From here on the ``average`` parameter applies as usual.
Expand All @@ -409,9 +406,7 @@ class Accuracy(StatScores):
multiclass:
Used only in certain special cases, where you want to treat inputs as a different type
than what they appear to be. See the parameter's
:ref:`documentation section <pages/classification:using the multiclass parameter>`
for a more detailed explanation and examples.
than what they appear to be.
subset_accuracy:
Whether to compute subset accuracy for multi-label and multi-dimensional
Expand Down Expand Up @@ -557,9 +552,7 @@ def __init__(
self.add_state("total", default=tensor(0), dist_reduce_fx="sum")

def update(self, preds: Tensor, target: Tensor) -> None: # type: ignore
"""Update state with predictions and targets. See
:ref:`pages/classification:input types` for more information on input
types.
"""Update state with predictions and targets.
Args:
preds: Predictions from model (logits, probabilities, or labels)
Expand Down
10 changes: 4 additions & 6 deletions src/torchmetrics/classification/dice.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Dice(StatScores):
The reduction method (how the precision scores are aggregated) is controlled by the
``average`` parameter, and additionally by the ``mdmc_average`` parameter in the
multi-dimensional multi-class case. Accepts all inputs listed in :ref:`pages/classification:input types`.
multi-dimensional multi-class case.
Args:
num_classes:
Expand Down Expand Up @@ -69,11 +69,11 @@ class Dice(StatScores):
- ``'samplewise'``: In this case, the statistics are computed separately for each
sample on the ``N`` axis, and then averaged over samples.
The computation for each sample is done by treating the flattened extra axes ``...``
(see :ref:`pages/classification:input types`) as the ``N`` dimension within the sample,
as the ``N`` dimension within the sample,
and computing the metric for the sample based on that.
- ``'global'``: In this case the ``N`` and ``...`` dimensions of the inputs
(see :ref:`pages/classification:input types`) are flattened into a new ``N_X`` sample axis, i.e.
are flattened into a new ``N_X`` sample axis, i.e.
the inputs are treated as if they were ``(N_X, C)``.
From here on the ``average`` parameter applies as usual.
Expand All @@ -90,9 +90,7 @@ class Dice(StatScores):
multiclass:
Used only in certain special cases, where you want to treat inputs as a different type
than what they appear to be. See the parameter's
:ref:`documentation section <pages/classification:using the multiclass parameter>`
for a more detailed explanation and examples.
than what they appear to be.
kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
Expand Down
14 changes: 4 additions & 10 deletions src/torchmetrics/classification/f_beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,11 +773,10 @@ class FBetaScore(StatScores):
- ``'samplewise'``: In this case, the statistics are computed separately for each
sample on the ``N`` axis, and then averaged over samples.
The computation for each sample is done by treating the flattened extra axes ``...``
(see :ref:`pages/classification:input types`) as the ``N`` dimension within the sample,
as the ``N`` dimension within the sample,
and computing the metric for the sample based on that.
- ``'global'``: In this case the ``N`` and ``...`` dimensions of the inputs
(see :ref:`pages/classification:input types`)
are flattened into a new ``N_X`` sample axis, i.e. the inputs are treated as if they
were ``(N_X, C)``. From here on the ``average`` parameter applies as usual.
Expand All @@ -795,9 +794,7 @@ class FBetaScore(StatScores):
multiclass:
Used only in certain special cases, where you want to treat inputs as a different type
than what they appear to be. See the parameter's
:ref:`documentation section <pages/classification:using the multiclass parameter>`
for a more detailed explanation and examples.
than what they appear to be.
kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
Expand Down Expand Up @@ -958,11 +955,10 @@ class F1Score(FBetaScore):
- ``'samplewise'``: In this case, the statistics are computed separately for each
sample on the ``N`` axis, and then averaged over samples.
The computation for each sample is done by treating the flattened extra axes ``...``
(see :ref:`pages/classification:input types`) as the ``N`` dimension within the sample,
as the ``N`` dimension within the sample,
and computing the metric for the sample based on that.
- ``'global'``: In this case the ``N`` and ``...`` dimensions of the inputs
(see :ref:`pages/classification:input types`)
are flattened into a new ``N_X`` sample axis, i.e. the inputs are treated as if they
were ``(N_X, C)``. From here on the ``average`` parameter applies as usual.
Expand All @@ -979,9 +975,7 @@ class F1Score(FBetaScore):
multiclass:
Used only in certain special cases, where you want to treat inputs as a different type
than what they appear to be. See the parameter's
:ref:`documentation section <pages/classification:using the multiclass parameter>`
for a more detailed explanation and examples.
than what they appear to be.
kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
Expand Down
4 changes: 0 additions & 4 deletions src/torchmetrics/classification/hamming.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,6 @@ class HammingDistance(Metric):
treats each possible label separately - meaning that, for example, multi-class data is
treated as if it were multi-label.
Accepts all input types listed in :ref:`pages/classification:input types`.
Args:
threshold:
Threshold for transforming probability or logit predictions to binary ``(0,1)`` predictions, in the case
Expand Down Expand Up @@ -423,8 +421,6 @@ def __init__(
def update(self, preds: Tensor, target: Tensor) -> None: # type: ignore
"""Update state with predictions and targets.
See :ref:`pages/classification:input types` for more information on input types.
Args:
preds: Predictions from model (probabilities, logits or labels)
target: Ground truth labels
Expand Down
19 changes: 7 additions & 12 deletions src/torchmetrics/classification/precision_recall.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ class Precision(StatScores):
The reduction method (how the precision scores are aggregated) is controlled by the
``average`` parameter, and additionally by the ``mdmc_average`` parameter in the
multi-dimensional multi-class case. Accepts all inputs listed in :ref:`pages/classification:input types`.
multi-dimensional multi-class case.
Args:
num_classes:
Expand Down Expand Up @@ -657,11 +657,11 @@ class Precision(StatScores):
- ``'samplewise'``: In this case, the statistics are computed separately for each
sample on the ``N`` axis, and then averaged over samples.
The computation for each sample is done by treating the flattened extra axes ``...``
(see :ref:`pages/classification:input types`) as the ``N`` dimension within the sample,
as the ``N`` dimension within the sample,
and computing the metric for the sample based on that.
- ``'global'``: In this case the ``N`` and ``...`` dimensions of the inputs
(see :ref:`pages/classification:input types`) are flattened into a new ``N_X`` sample axis, i.e.
are flattened into a new ``N_X`` sample axis, i.e.
the inputs are treated as if they were ``(N_X, C)``.
From here on the ``average`` parameter applies as usual.
Expand All @@ -678,9 +678,7 @@ class Precision(StatScores):
multiclass:
Used only in certain special cases, where you want to treat inputs as a different type
than what they appear to be. See the parameter's
:ref:`documentation section <pages/classification:using the multiclass parameter>`
for a more detailed explanation and examples.
than what they appear to be.
kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
Expand Down Expand Up @@ -813,7 +811,7 @@ class Recall(StatScores):
The reduction method (how the recall scores are aggregated) is controlled by the
``average`` parameter, and additionally by the ``mdmc_average`` parameter in the
multi-dimensional multi-class case. Accepts all inputs listed in :ref:`pages/classification:input types`.
multi-dimensional multi-class case.
Args:
num_classes:
Expand Down Expand Up @@ -846,11 +844,10 @@ class Recall(StatScores):
- ``'samplewise'``: In this case, the statistics are computed separately for each
sample on the ``N`` axis, and then averaged over samples.
The computation for each sample is done by treating the flattened extra axes ``...``
(see :ref:`pages/classification:input types`) as the ``N`` dimension within the sample,
as the ``N`` dimension within the sample,
and computing the metric for the sample based on that.
- ``'global'``: In this case the ``N`` and ``...`` dimensions of the inputs
(see :ref:`pages/classification:input types`)
are flattened into a new ``N_X`` sample axis, i.e. the inputs are treated as if they
were ``(N_X, C)``. From here on the ``average`` parameter applies as usual.
Expand All @@ -868,9 +865,7 @@ class Recall(StatScores):
multiclass:
Used only in certain special cases, where you want to treat inputs as a different type
than what they appear to be. See the parameter's
:ref:`documentation section <pages/classification:using the multiclass parameter>`
for a more detailed explanation and examples.
than what they appear to be.
kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
Expand Down
9 changes: 3 additions & 6 deletions src/torchmetrics/classification/specificity.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ class Specificity(StatScores):
The reduction method (how the specificity scores are aggregated) is controlled by the
``average`` parameter, and additionally by the ``mdmc_average`` parameter in the
multi-dimensional multi-class case. Accepts all inputs listed in :ref:`pages/classification:input types`.
multi-dimensional multi-class case.
Args:
num_classes:
Expand Down Expand Up @@ -348,11 +348,10 @@ class Specificity(StatScores):
- ``'samplewise'``: In this case, the statistics are computed separately for each
sample on the ``N`` axis, and then averaged over samples.
The computation for each sample is done by treating the flattened extra axes ``...``
(see :ref:`pages/classification:input types`) as the ``N`` dimension within the sample,
as the ``N`` dimension within the sample,
and computing the metric for the sample based on that.
- ``'global'``: In this case the ``N`` and ``...`` dimensions of the inputs
(see :ref:`pages/classification:input types`)
are flattened into a new ``N_X`` sample axis, i.e. the inputs are treated as if they
were ``(N_X, C)``. From here on the ``average`` parameter applies as usual.
Expand All @@ -371,9 +370,7 @@ class Specificity(StatScores):
multiclass:
Used only in certain special cases, where you want to treat inputs as a different type
than what they appear to be. See the parameter's
:ref:`documentation section <pages/classification:using the multiclass parameter>`
for a more detailed explanation and examples.
than what they appear to be.
kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
Expand Down
10 changes: 3 additions & 7 deletions src/torchmetrics/classification/stat_scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ class StatScores(Metric):
``reduce`` parameter, and additionally by the ``mdmc_reduce`` parameter in the
multi-dimensional multi-class case.
Accepts all inputs listed in :ref:`pages/classification:input types`.
Args:
threshold:
Expand Down Expand Up @@ -539,7 +539,7 @@ class StatScores(Metric):
mdmc_reduce: Defines how the multi-dimensional multi-class inputs are handeled. Should be one of the following:
- ``None`` [default]: Should be left unchanged if your data is not multi-dimensional
multi-class (see :ref:`pages/classification:input types` for the definition of input types).
multi-class.
- ``'samplewise'``: In this case, the statistics are computed separately for each
sample on the ``N`` axis, and then the outputs are concatenated together. In each
Expand All @@ -553,9 +553,7 @@ class StatScores(Metric):
multiclass:
Used only in certain special cases, where you want to treat inputs as a different type
than what they appear to be. See the parameter's
:ref:`documentation section <pages/classification:using the multiclass parameter>`
for a more detailed explanation and examples.
than what they appear to be.
kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
Expand Down Expand Up @@ -690,8 +688,6 @@ def __init__(
def update(self, preds: Tensor, target: Tensor) -> None: # type: ignore
"""Update state with predictions and targets.
See :ref:`pages/classification:input types` for more information on input types.
Args:
preds: Predictions from model (probabilities, logits or labels)
target: Ground truth values
Expand Down
10 changes: 3 additions & 7 deletions src/torchmetrics/functional/classification/accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,6 @@ def accuracy(
changed to subset accuracy (which requires all labels or sub-samples in the sample to
be correctly predicted) by setting ``subset_accuracy=True``.
Accepts all input types listed in :ref:`pages/classification:input types`.
Args:
preds: Predictions from model (probabilities, logits or labels)
target: Ground truth labels
Expand Down Expand Up @@ -693,11 +691,11 @@ def accuracy(
- ``'samplewise'``: In this case, the statistics are computed separately for each
sample on the ``N`` axis, and then averaged over samples.
The computation for each sample is done by treating the flattened extra axes ``...``
(see :ref:`pages/classification:input types`) as the ``N`` dimension within the sample,
as the ``N`` dimension within the sample,
and computing the metric for the sample based on that.
- ``'global'``: In this case the ``N`` and ``...`` dimensions of the inputs
(see :ref:`pages/classification:input types`)
are flattened into a new ``N_X`` sample axis, i.e. the inputs are treated as if they
were ``(N_X, C)``. From here on the ``average`` parameter applies as usual.
Expand All @@ -715,9 +713,7 @@ def accuracy(
Should be left at default (``None``) for all other types of inputs.
multiclass:
Used only in certain special cases, where you want to treat inputs as a different type
than what they appear to be. See the parameter's
:ref:`documentation section <pages/classification:using the multiclass parameter>`
for a more detailed explanation and examples.
than what they appear to be.
ignore_index:
Integer specifying a target class to ignore. If given, this class index does not contribute
to the returned score, regardless of reduction method. If an index is ignored, and ``average=None``
Expand Down
9 changes: 3 additions & 6 deletions src/torchmetrics/functional/classification/dice.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def dice(
The reduction method (how the recall scores are aggregated) is controlled by the
``average`` parameter, and additionally by the ``mdmc_average`` parameter in the
multi-dimensional multi-class case. Accepts all inputs listed in :ref:`pages/classification:input types`.
multi-dimensional multi-class case.
Args:
preds: Predictions from model (probabilities, logits or labels)
Expand Down Expand Up @@ -213,11 +213,10 @@ def dice(
- ``'samplewise'``: In this case, the statistics are computed separately for each
sample on the ``N`` axis, and then averaged over samples.
The computation for each sample is done by treating the flattened extra axes ``...``
(see :ref:`pages/classification:input types`) as the ``N`` dimension within the sample,
as the ``N`` dimension within the sample,
and computing the metric for the sample based on that.
- ``'global'``: In this case the ``N`` and ``...`` dimensions of the inputs
(see :ref:`pages/classification:input types`)
are flattened into a new ``N_X`` sample axis, i.e. the inputs are treated as if they
were ``(N_X, C)``. From here on the ``average`` parameter applies as usual.
Expand All @@ -240,9 +239,7 @@ def dice(
Should be left at default (``None``) for all other types of inputs.
multiclass:
Used only in certain special cases, where you want to treat inputs as a different type
than what they appear to be. See the parameter's
:ref:`documentation section <pages/classification:using the multiclass parameter>`
for a more detailed explanation and examples.
than what they appear to be.
Return:
The shape of the returned tensor depends on the ``average`` parameter
Expand Down
Loading

0 comments on commit c35620f

Please sign in to comment.