From eb72f6c15ef2cd9db7887e7fd2f514ad93091d17 Mon Sep 17 00:00:00 2001 From: Roger Shieh Date: Fri, 11 Dec 2020 13:48:01 +0800 Subject: [PATCH 1/5] fix functional f1 fbeta formatting --- pytorch_lightning/metrics/functional/f_beta.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pytorch_lightning/metrics/functional/f_beta.py b/pytorch_lightning/metrics/functional/f_beta.py index 3f0a7a0449325..b871f6bf9a80c 100755 --- a/pytorch_lightning/metrics/functional/f_beta.py +++ b/pytorch_lightning/metrics/functional/f_beta.py @@ -83,11 +83,11 @@ def fbeta( Threshold value for binary or multi-label logits. default: 0.5 average: - * `'micro'` computes metric globally - * `'macro'` computes metric for each class and uniformly averages them - * `'weighted'` computes metric for each class and does a weighted-average, + - ``'micro'`` computes metric globally + - ``'macro'`` computes metric for each class and uniformly averages them + - ``'weighted'`` computes metric for each class and does a weighted-average, where each class is weighted by their support (accounts for class imbalance) - * `None` computes and returns the metric per class + - ``'none'`` computes and returns the metric per class multilabel: If predictions are from multilabel classification. @@ -136,11 +136,11 @@ def f1( Threshold value for binary or multi-label logits. default: 0.5 average: - * `'micro'` computes metric globally - * `'macro'` computes metric for each class and uniformly averages them - * `'weighted'` computes metric for each class and does a weighted-average, + - ``'micro'`` computes metric globally + - ``'macro'`` computes metric for each class and uniformly averages them + - ``'weighted'`` computes metric for each class and does a weighted-average, where each class is weighted by their support (accounts for class imbalance) - * `None` computes and returns the metric per class + - ``'none'`` computes and returns the metric per class multilabel: If predictions are from multilabel classification. From 7a267cf62bb33b6e500ebaf6066d27ac7320fc73 Mon Sep 17 00:00:00 2001 From: Roger Shieh Date: Fri, 11 Dec 2020 13:54:33 +0800 Subject: [PATCH 2/5] Update f_beta.py --- .../metrics/classification/f_beta.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pytorch_lightning/metrics/classification/f_beta.py b/pytorch_lightning/metrics/classification/f_beta.py index 56cc00f9a5dce..7b72aac9c22eb 100755 --- a/pytorch_lightning/metrics/classification/f_beta.py +++ b/pytorch_lightning/metrics/classification/f_beta.py @@ -51,11 +51,11 @@ class FBeta(Metric): Threshold value for binary or multi-label logits. default: 0.5 average: - * `'micro'` computes metric globally - * `'macro'` computes metric for each class and uniformly averages them - * `'weighted'` computes metric for each class and does a weighted-average, + - ``'micro'`` computes metric globally + - ``'macro'`` computes metric for each class and uniformly averages them + - ``'weighted'`` computes metric for each class and does a weighted-average, where each class is weighted by their support (accounts for class imbalance) - * `None` computes and returns the metric per class + - ``'none'`` computes and returns the metric per class multilabel: If predictions are from multilabel classification. compute_on_step: @@ -156,11 +156,11 @@ class F1(FBeta): Threshold value for binary or multi-label logits. default: 0.5 average: - * `'micro'` computes metric globally - * `'macro'` computes metric for each class and uniformly averages them - * `'weighted'` computes metric for each class and does a weighted-average, + - ``'micro'`` computes metric globally + - ``'macro'`` computes metric for each class and uniformly averages them + - ``'weighted'`` computes metric for each class and does a weighted-average, where each class is weighted by their support (accounts for class imbalance) - * `None` computes and returns the metric per class + - ``'none'`` computes and returns the metric per class multilabel: If predictions are from multilabel classification. compute_on_step: From c7d052e04281dc12d764932a3d6de96312e71242 Mon Sep 17 00:00:00 2001 From: Roger Shieh Date: Fri, 11 Dec 2020 15:26:28 +0800 Subject: [PATCH 3/5] remove line breaks --- pytorch_lightning/metrics/classification/f_beta.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pytorch_lightning/metrics/classification/f_beta.py b/pytorch_lightning/metrics/classification/f_beta.py index 7b72aac9c22eb..a6f53031b80bb 100755 --- a/pytorch_lightning/metrics/classification/f_beta.py +++ b/pytorch_lightning/metrics/classification/f_beta.py @@ -53,8 +53,7 @@ class FBeta(Metric): average: - ``'micro'`` computes metric globally - ``'macro'`` computes metric for each class and uniformly averages them - - ``'weighted'`` computes metric for each class and does a weighted-average, - where each class is weighted by their support (accounts for class imbalance) + - ``'weighted'`` computes metric for each class and does a weighted-average, where each class is weighted by their support (accounts for class imbalance) - ``'none'`` computes and returns the metric per class multilabel: If predictions are from multilabel classification. @@ -158,8 +157,7 @@ class F1(FBeta): average: - ``'micro'`` computes metric globally - ``'macro'`` computes metric for each class and uniformly averages them - - ``'weighted'`` computes metric for each class and does a weighted-average, - where each class is weighted by their support (accounts for class imbalance) + - ``'weighted'`` computes metric for each class and does a weighted-average, where each class is weighted by their support (accounts for class imbalance) - ``'none'`` computes and returns the metric per class multilabel: If predictions are from multilabel classification. From 647f48a142d1cf0102c5f8c0dba9f6c5e0441a63 Mon Sep 17 00:00:00 2001 From: Roger Shieh Date: Fri, 11 Dec 2020 15:33:31 +0800 Subject: [PATCH 4/5] Update f_beta.py add line breaks and pad --- pytorch_lightning/metrics/classification/f_beta.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pytorch_lightning/metrics/classification/f_beta.py b/pytorch_lightning/metrics/classification/f_beta.py index a6f53031b80bb..2a57994cf41dd 100755 --- a/pytorch_lightning/metrics/classification/f_beta.py +++ b/pytorch_lightning/metrics/classification/f_beta.py @@ -53,7 +53,8 @@ class FBeta(Metric): average: - ``'micro'`` computes metric globally - ``'macro'`` computes metric for each class and uniformly averages them - - ``'weighted'`` computes metric for each class and does a weighted-average, where each class is weighted by their support (accounts for class imbalance) + - ``'weighted'`` computes metric for each class and does a weighted-average, + where each class is weighted by their support (accounts for class imbalance) - ``'none'`` computes and returns the metric per class multilabel: If predictions are from multilabel classification. @@ -157,7 +158,8 @@ class F1(FBeta): average: - ``'micro'`` computes metric globally - ``'macro'`` computes metric for each class and uniformly averages them - - ``'weighted'`` computes metric for each class and does a weighted-average, where each class is weighted by their support (accounts for class imbalance) + - ``'weighted'`` computes metric for each class and does a weighted-average, + where each class is weighted by their support (accounts for class imbalance) - ``'none'`` computes and returns the metric per class multilabel: If predictions are from multilabel classification. From c9657101edcb38ca66a1c62c499016e792336e56 Mon Sep 17 00:00:00 2001 From: Roger Shieh Date: Fri, 11 Dec 2020 15:34:41 +0800 Subject: [PATCH 5/5] pad linea breaks with 2 spaces instead of tab --- pytorch_lightning/metrics/functional/f_beta.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pytorch_lightning/metrics/functional/f_beta.py b/pytorch_lightning/metrics/functional/f_beta.py index b871f6bf9a80c..5f6962d2b3964 100755 --- a/pytorch_lightning/metrics/functional/f_beta.py +++ b/pytorch_lightning/metrics/functional/f_beta.py @@ -86,7 +86,7 @@ def fbeta( - ``'micro'`` computes metric globally - ``'macro'`` computes metric for each class and uniformly averages them - ``'weighted'`` computes metric for each class and does a weighted-average, - where each class is weighted by their support (accounts for class imbalance) + where each class is weighted by their support (accounts for class imbalance) - ``'none'`` computes and returns the metric per class multilabel: If predictions are from multilabel classification. @@ -139,7 +139,7 @@ def f1( - ``'micro'`` computes metric globally - ``'macro'`` computes metric for each class and uniformly averages them - ``'weighted'`` computes metric for each class and does a weighted-average, - where each class is weighted by their support (accounts for class imbalance) + where each class is weighted by their support (accounts for class imbalance) - ``'none'`` computes and returns the metric per class multilabel: If predictions are from multilabel classification.