From 036d1c66fa33eeb9c0d4b0946752035f9b978c23 Mon Sep 17 00:00:00 2001 From: Jirka Borovec Date: Wed, 17 Mar 2021 11:56:01 +0100 Subject: [PATCH] Prune deprecated (#92) * deprecation * notes --- torchmetrics/classification/checks.py | 9 +++++---- torchmetrics/classification/precision_recall.py | 14 ++++---------- torchmetrics/classification/stat_scores.py | 4 ++-- .../functional/classification/precision_recall.py | 15 ++++++--------- .../functional/classification/stat_scores.py | 4 ++-- 5 files changed, 19 insertions(+), 27 deletions(-) diff --git a/torchmetrics/classification/checks.py b/torchmetrics/classification/checks.py index 2a44af1..a6058de 100644 --- a/torchmetrics/classification/checks.py +++ b/torchmetrics/classification/checks.py @@ -352,10 +352,11 @@ def _input_format_classification( ``is_multiclass=False`` (and there are up to two classes), then the data is returned as ``(N, X)`` binary tensors (multi-label). - Note that where a one-hot transformation needs to be performed and the number of classes - is not implicitly given by a ``C`` dimension, the new ``C`` dimension will either be - equal to ``num_classes``, if it is given, or the maximum label value in preds and - target. + Note: + Where a one-hot transformation needs to be performed and the number of classes + is not implicitly given by a ``C`` dimension, the new ``C`` dimension will either be + equal to ``num_classes``, if it is given, or the maximum label value in preds and + target. Args: preds: Tensor with predictions (labels or probabilities) diff --git a/torchmetrics/classification/precision_recall.py b/torchmetrics/classification/precision_recall.py index 4204dfb..7bb8a7f 100644 --- a/torchmetrics/classification/precision_recall.py +++ b/torchmetrics/classification/precision_recall.py @@ -52,10 +52,8 @@ class Precision(StatScores): - ``'samples'``: Calculate the metric for each sample, and average the metrics across samples (with equal weights for each sample). - Note that what is considered a sample in the multi-dimensional multi-class case - depends on the value of ``mdmc_average``. - multilabel: - .. warning :: This parameter is deprecated and has no effect. Will be removed in v1.4.0. + .. note:: What is considered a sample in the multi-dimensional multi-class case + depends on the value of ``mdmc_average``. mdmc_average: Defines how averaging is done for multi-dimensional multi-class inputs (on top of the @@ -124,7 +122,6 @@ class Precision(StatScores): num_classes: Optional[int] = None, threshold: float = 0.5, average: str = "micro", - multilabel: bool = False, mdmc_average: Optional[str] = None, ignore_index: Optional[int] = None, top_k: Optional[int] = None, @@ -202,10 +199,8 @@ class Recall(StatScores): - ``'samples'``: Calculate the metric for each sample, and average the metrics across samples (with equal weights for each sample). - Note that what is considered a sample in the multi-dimensional multi-class case - depends on the value of ``mdmc_average``. - multilabel: - .. warning :: This parameter is deprecated and has no effect. Will be removed in v1.4.0. + .. note:: What is considered a sample in the multi-dimensional multi-class case + depends on the value of ``mdmc_average``. mdmc_average: Defines how averaging is done for multi-dimensional multi-class inputs (on top of the @@ -275,7 +270,6 @@ class Recall(StatScores): num_classes: Optional[int] = None, threshold: float = 0.5, average: str = "micro", - multilabel: bool = False, mdmc_average: Optional[str] = None, ignore_index: Optional[int] = None, top_k: Optional[int] = None, diff --git a/torchmetrics/classification/stat_scores.py b/torchmetrics/classification/stat_scores.py index ca6d0b8..8312714 100644 --- a/torchmetrics/classification/stat_scores.py +++ b/torchmetrics/classification/stat_scores.py @@ -56,8 +56,8 @@ class StatScores(Metric): - ``'samples'``: Counts the statistics for each sample separately (over all classes). Each statistic is represented by a ``(N, )`` 1d tensor. - Note that what is considered a sample in the multi-dimensional multi-class case - depends on the value of ``mdmc_reduce``. + .. note:: Wwhat is considered a sample in the multi-dimensional multi-class case + depends on the value of ``mdmc_reduce``. num_classes: Number of classes. Necessary for (multi-dimensional) multi-class or multi-label data. diff --git a/torchmetrics/functional/classification/precision_recall.py b/torchmetrics/functional/classification/precision_recall.py index 5fa001a..6239545 100644 --- a/torchmetrics/functional/classification/precision_recall.py +++ b/torchmetrics/functional/classification/precision_recall.py @@ -76,11 +76,8 @@ def precision( - ``'samples'``: Calculate the metric for each sample, and average the metrics across samples (with equal weights for each sample). - Note that what is considered a sample in the multi-dimensional multi-class case - depends on the value of ``mdmc_average``. - - class_reduction: - .. warning :: This parameter is deprecated, use ``average``. Will be removed in v1.4.0. + .. note:: What is considered a sample in the multi-dimensional multi-class case + depends on the value of ``mdmc_average``. mdmc_average: Defines how averaging is done for multi-dimensional multi-class inputs (on top of the @@ -229,8 +226,8 @@ def recall( - ``'samples'``: Calculate the metric for each sample, and average the metrics across samples (with equal weights for each sample). - Note that what is considered a sample in the multi-dimensional multi-class case - depends on the value of ``mdmc_average``. + .. note:: What is considered a sample in the multi-dimensional multi-class case + depends on the value of ``mdmc_average``. mdmc_average: Defines how averaging is done for multi-dimensional multi-class inputs (on top of the @@ -365,8 +362,8 @@ def precision_recall( - ``'samples'``: Calculate the metric for each sample, and average the metrics across samples (with equal weights for each sample). - Note that what is considered a sample in the multi-dimensional multi-class case - depends on the value of ``mdmc_average``. + .. note:: What is considered a sample in the multi-dimensional multi-class case + depends on the value of ``mdmc_average``. mdmc_average: Defines how averaging is done for multi-dimensional multi-class inputs (on top of the diff --git a/torchmetrics/functional/classification/stat_scores.py b/torchmetrics/functional/classification/stat_scores.py index 514af9f..3c44b66 100644 --- a/torchmetrics/functional/classification/stat_scores.py +++ b/torchmetrics/functional/classification/stat_scores.py @@ -181,8 +181,8 @@ def stat_scores( - ``'samples'``: Counts the statistics for each sample separately (over all classes). Each statistic is represented by a ``(N, )`` 1d tensor. - Note that what is considered a sample in the multi-dimensional multi-class case - depends on the value of ``mdmc_reduce``. + .. note:: What is considered a sample in the multi-dimensional multi-class case + depends on the value of ``mdmc_reduce``. num_classes: Number of classes. Necessary for (multi-dimensional) multi-class or multi-label data.