From c35620f690de2a2f7cd01882c0fbff8e70989715 Mon Sep 17 00:00:00 2001 From: SkafteNicki Date: Wed, 12 Oct 2022 20:17:21 +0200 Subject: [PATCH] fix doc linking --- src/torchmetrics/classification/accuracy.py | 13 +++------ src/torchmetrics/classification/dice.py | 10 +++---- src/torchmetrics/classification/f_beta.py | 14 +++------- src/torchmetrics/classification/hamming.py | 4 --- .../classification/precision_recall.py | 19 +++++-------- .../classification/specificity.py | 9 +++---- .../classification/stat_scores.py | 10 +++---- .../functional/classification/accuracy.py | 10 +++---- .../functional/classification/dice.py | 9 +++---- .../functional/classification/f_beta.py | 18 +++++-------- .../functional/classification/hamming.py | 2 -- .../classification/precision_recall.py | 27 +++++++------------ .../functional/classification/specificity.py | 9 +++---- .../functional/classification/stat_scores.py | 8 +++--- 14 files changed, 51 insertions(+), 111 deletions(-) diff --git a/src/torchmetrics/classification/accuracy.py b/src/torchmetrics/classification/accuracy.py index 79051ffe3f2..5f564e1d77a 100644 --- a/src/torchmetrics/classification/accuracy.py +++ b/src/torchmetrics/classification/accuracy.py @@ -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. @@ -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. @@ -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 ` - 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 @@ -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) diff --git a/src/torchmetrics/classification/dice.py b/src/torchmetrics/classification/dice.py index 771318851b1..9e025dac564 100644 --- a/src/torchmetrics/classification/dice.py +++ b/src/torchmetrics/classification/dice.py @@ -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: @@ -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. @@ -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 ` - for a more detailed explanation and examples. + than what they appear to be. kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info. diff --git a/src/torchmetrics/classification/f_beta.py b/src/torchmetrics/classification/f_beta.py index dca2d378170..d968810ea9d 100644 --- a/src/torchmetrics/classification/f_beta.py +++ b/src/torchmetrics/classification/f_beta.py @@ -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. @@ -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 ` - for a more detailed explanation and examples. + than what they appear to be. kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info. @@ -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. @@ -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 ` - for a more detailed explanation and examples. + than what they appear to be. kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info. diff --git a/src/torchmetrics/classification/hamming.py b/src/torchmetrics/classification/hamming.py index cd8bf36e291..ef6df5d9f65 100644 --- a/src/torchmetrics/classification/hamming.py +++ b/src/torchmetrics/classification/hamming.py @@ -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 @@ -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 diff --git a/src/torchmetrics/classification/precision_recall.py b/src/torchmetrics/classification/precision_recall.py index d05a38f3e99..cb2874d1efa 100644 --- a/src/torchmetrics/classification/precision_recall.py +++ b/src/torchmetrics/classification/precision_recall.py @@ -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: @@ -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. @@ -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 ` - for a more detailed explanation and examples. + than what they appear to be. kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info. @@ -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: @@ -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. @@ -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 ` - for a more detailed explanation and examples. + than what they appear to be. kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info. diff --git a/src/torchmetrics/classification/specificity.py b/src/torchmetrics/classification/specificity.py index d7966653e70..0e618c5fccb 100644 --- a/src/torchmetrics/classification/specificity.py +++ b/src/torchmetrics/classification/specificity.py @@ -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: @@ -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. @@ -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 ` - for a more detailed explanation and examples. + than what they appear to be. kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info. diff --git a/src/torchmetrics/classification/stat_scores.py b/src/torchmetrics/classification/stat_scores.py index c358ca63262..53d9b414653 100644 --- a/src/torchmetrics/classification/stat_scores.py +++ b/src/torchmetrics/classification/stat_scores.py @@ -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: @@ -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 @@ -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 ` - for a more detailed explanation and examples. + than what they appear to be. kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info. @@ -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 diff --git a/src/torchmetrics/functional/classification/accuracy.py b/src/torchmetrics/functional/classification/accuracy.py index fa641ba59c7..9fa0ddc64d9 100644 --- a/src/torchmetrics/functional/classification/accuracy.py +++ b/src/torchmetrics/functional/classification/accuracy.py @@ -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 @@ -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. @@ -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 ` - 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`` diff --git a/src/torchmetrics/functional/classification/dice.py b/src/torchmetrics/functional/classification/dice.py index 602d4a1d1d4..3449c182913 100644 --- a/src/torchmetrics/functional/classification/dice.py +++ b/src/torchmetrics/functional/classification/dice.py @@ -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) @@ -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. @@ -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 ` - 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 diff --git a/src/torchmetrics/functional/classification/f_beta.py b/src/torchmetrics/functional/classification/f_beta.py index 7448b828ca0..9e142741ec5 100644 --- a/src/torchmetrics/functional/classification/f_beta.py +++ b/src/torchmetrics/functional/classification/f_beta.py @@ -822,7 +822,7 @@ def fbeta_score( 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: preds: Predictions from model (probabilities, logits or labels) @@ -856,10 +856,9 @@ def fbeta_score( - ``'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. @@ -880,9 +879,7 @@ def fbeta_score( 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 ` - 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 @@ -992,7 +989,7 @@ def f1_score( 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: preds: Predictions from model (probabilities, logits or labels) @@ -1026,11 +1023,10 @@ def f1_score( - ``'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. @@ -1054,9 +1050,7 @@ def f1_score( 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 ` - 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 diff --git a/src/torchmetrics/functional/classification/hamming.py b/src/torchmetrics/functional/classification/hamming.py index 2d0b0ef7f8d..9433777f529 100644 --- a/src/torchmetrics/functional/classification/hamming.py +++ b/src/torchmetrics/functional/classification/hamming.py @@ -462,8 +462,6 @@ def hamming_distance( 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: preds: Predictions from model (probabilities, logits or labels) target: Ground truth diff --git a/src/torchmetrics/functional/classification/precision_recall.py b/src/torchmetrics/functional/classification/precision_recall.py index 4fa6801b0c5..8052504c9de 100644 --- a/src/torchmetrics/functional/classification/precision_recall.py +++ b/src/torchmetrics/functional/classification/precision_recall.py @@ -738,7 +738,7 @@ def precision( 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: preds: Predictions from model (probabilities, logits or labels) @@ -771,11 +771,10 @@ def precision( - ``'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. @@ -798,9 +797,7 @@ def precision( 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 ` - 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 @@ -969,7 +966,7 @@ def recall( 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) @@ -1003,11 +1000,10 @@ def recall( - ``'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. @@ -1030,9 +1026,7 @@ def recall( 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 ` - 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 @@ -1139,7 +1133,7 @@ def precision_recall( 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) @@ -1172,11 +1166,10 @@ def precision_recall( - ``'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. @@ -1197,9 +1190,7 @@ def precision_recall( 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 ` - for a more detailed explanation and examples. + than what they appear to be. Return: The function returns a tuple with two elements: precision and recall. Their shape diff --git a/src/torchmetrics/functional/classification/specificity.py b/src/torchmetrics/functional/classification/specificity.py index b78757d0be1..d155b1b9dcf 100644 --- a/src/torchmetrics/functional/classification/specificity.py +++ b/src/torchmetrics/functional/classification/specificity.py @@ -437,7 +437,7 @@ def specificity( 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: preds: Predictions from model (probabilities, or labels) @@ -470,11 +470,10 @@ def specificity( - ``'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. @@ -496,9 +495,7 @@ def specificity( Should be left unset (``None``) for inputs with label predictions. 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 ` - 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 diff --git a/src/torchmetrics/functional/classification/stat_scores.py b/src/torchmetrics/functional/classification/stat_scores.py index ab41fc6dee8..9909f095b1c 100644 --- a/src/torchmetrics/functional/classification/stat_scores.py +++ b/src/torchmetrics/functional/classification/stat_scores.py @@ -1107,7 +1107,7 @@ def stat_scores( The reduction method (how the statistics are aggregated) is controlled by the ``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`. + multi-dimensional multi-class case. Args: preds: Predictions from model (probabilities, logits or labels) @@ -1147,7 +1147,7 @@ def stat_scores( 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 @@ -1161,9 +1161,7 @@ def stat_scores( 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 ` - for a more detailed explanation and examples. + than what they appear to be. Return: The metric returns a tensor of shape ``(..., 5)``, where the last dimension corresponds