Skip to content

Commit 6c37999

Browse files
authored
Merge branch 'master' into ci/upload-failure
2 parents 4dbcf13 + 1e501f0 commit 6c37999

File tree

7 files changed

+398
-13
lines changed

7 files changed

+398
-13
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
8585

8686
### Changed
8787

88-
- Removed `multiclass_roc` and `multiclass_precision_recall_curve`, use `roc` and `precision_recall_curve` instead ([#4549](https://github.com/PyTorchLightning/pytorch-lightning/pull/4549))
8988
- Tuner algorithms will be skipped if `fast_dev_run=True` ([#3903](https://github.com/PyTorchLightning/pytorch-lightning/pull/3903))
90-
- WandbLogger does not force wandb `reinit` arg to True anymore and creates a run only when needed ([#4648](https://github.com/PyTorchLightning/pytorch-lightning/pull/4648))
89+
- `WandbLogger` does not force wandb `reinit` arg to True anymore and creates a run only when needed ([#4648](https://github.com/PyTorchLightning/pytorch-lightning/pull/4648))
9190
- Changed `automatic_optimization` to be a model attribute ([#4602](https://github.com/PyTorchLightning/pytorch-lightning/pull/4602))
9291
- Changed `Simple Profiler` report to order by percentage time spent + num calls ([#4880](https://github.com/PyTorchLightning/pytorch-lightning/pull/4880))
9392
- Simplify optimization Logic ([#4984](https://github.com/PyTorchLightning/pytorch-lightning/pull/4984))
@@ -105,6 +104,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
105104
### Removed
106105

107106
- Removed `reorder` parameter of the `auc` metric ([#5004](https://github.com/PyTorchLightning/pytorch-lightning/pull/5004))
107+
- Removed `multiclass_roc` and `multiclass_precision_recall_curve`, use `roc` and `precision_recall_curve` instead ([#4549](https://github.com/PyTorchLightning/pytorch-lightning/pull/4549))
108108

109109
### Fixed
110110

pytorch_lightning/metrics/classification/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from pytorch_lightning.metrics.classification.accuracy import Accuracy
1515
from pytorch_lightning.metrics.classification.average_precision import AveragePrecision
1616
from pytorch_lightning.metrics.classification.confusion_matrix import ConfusionMatrix
17-
from pytorch_lightning.metrics.classification.f_beta import FBeta, F1
17+
from pytorch_lightning.metrics.classification.f_beta import FBeta, Fbeta, F1
1818
from pytorch_lightning.metrics.classification.precision_recall import Precision, Recall
1919
from pytorch_lightning.metrics.classification.precision_recall_curve import PrecisionRecallCurve
2020
from pytorch_lightning.metrics.classification.roc import ROC

pytorch_lightning/metrics/classification/f_beta.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
_fbeta_compute
2121
)
2222
from pytorch_lightning.metrics.metric import Metric
23+
from pytorch_lightning.utilities import rank_zero_warn
2324

2425

2526
class FBeta(Metric):
@@ -131,6 +132,34 @@ def compute(self) -> torch.Tensor:
131132
self.actual_positives, self.beta, self.average)
132133

133134

135+
# todo: remove in v1.2
136+
class Fbeta(FBeta):
137+
r"""
138+
Computes `F-score <https://en.wikipedia.org/wiki/F-score>`_
139+
140+
.. warning :: Deprecated in favor of :func:`~pytorch_lightning.metrics.classification.f_beta.FBeta`
141+
"""
142+
def __init__(
143+
self,
144+
num_classes: int,
145+
beta: float = 1.0,
146+
threshold: float = 0.5,
147+
average: str = "micro",
148+
multilabel: bool = False,
149+
compute_on_step: bool = True,
150+
dist_sync_on_step: bool = False,
151+
process_group: Optional[Any] = None,
152+
):
153+
rank_zero_warn(
154+
"This `Fbeta` was deprecated in v1.0.x in favor of"
155+
" `from pytorch_lightning.metrics.classification.f_beta import FBeta`."
156+
" It will be removed in v1.2.0", DeprecationWarning
157+
)
158+
super().__init__(
159+
num_classes, beta, threshold, average, multilabel, compute_on_step, dist_sync_on_step, process_group
160+
)
161+
162+
134163
class F1(FBeta):
135164
"""
136165
Computes F1 metric. F1 metrics correspond to a harmonic mean of the

pytorch_lightning/metrics/functional/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,18 @@
1717
auc,
1818
auroc,
1919
dice_score,
20+
f1_score,
21+
fbeta_score,
22+
get_num_classes,
23+
iou,
2024
multiclass_auroc,
2125
precision,
2226
precision_recall,
2327
recall,
2428
stat_scores,
2529
stat_scores_multiple_classes,
26-
iou,
30+
to_categorical,
31+
to_onehot,
2732
)
2833
from pytorch_lightning.metrics.functional.confusion_matrix import confusion_matrix
2934
# TODO: unify metrics between class and functional, add below

0 commit comments

Comments
 (0)