Skip to content

Commit 15c477e

Browse files
prajakta0111akihironittaPrajakta Phadkerohitgr7
authored
document exceptions for metrics/regression (#6202)
Co-authored-by: Akihiro Nitta <[email protected]> Co-authored-by: Prajakta Phadke <[email protected]> Co-authored-by: Rohit Gupta <[email protected]>
1 parent 111d9c7 commit 15c477e

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

pytorch_lightning/metrics/regression/explained_variance.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ class ExplainedVariance(Metric):
5959
process_group:
6060
Specify the process group on which synchronization is called. default: None (which selects the entire world)
6161
62+
Raises:
63+
ValueError:
64+
If ``multioutput`` is not one of ``"raw_values"``, ``"uniform_average"`` or ``"variance_weighted"``.
65+
6266
Example:
6367
6468
>>> from pytorch_lightning.metrics import ExplainedVariance

pytorch_lightning/metrics/regression/psnr.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ class PSNR(Metric):
5151
process_group:
5252
Specify the process group on which synchronization is called. default: None (which selects the entire world)
5353
54+
Raises:
55+
ValueError:
56+
If ``dim`` is not ``None`` and ``data_range`` is not given.
57+
5458
Example:
5559
5660
>>> from pytorch_lightning.metrics import PSNR

pytorch_lightning/metrics/regression/r2score.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ class R2Score(Metric):
6666
process_group:
6767
Specify the process group on which synchronization is called. default: None (which selects the entire world)
6868
69+
Raises:
70+
ValueError:
71+
If ``adjusted`` parameter is not an integer larger or equal to 0.
72+
ValueError:
73+
If ``multioutput`` is not one of ``"raw_values"``, ``"uniform_average"`` or ``"variance_weighted"``.
74+
6975
Example:
7076
7177
>>> from pytorch_lightning.metrics import R2Score
@@ -102,7 +108,7 @@ def __init__(
102108
self.num_outputs = num_outputs
103109

104110
if adjusted < 0 or not isinstance(adjusted, int):
105-
raise ValueError('`adjusted` parameter should be an integer larger or' ' equal to 0.')
111+
raise ValueError('`adjusted` parameter should be an integer larger or equal to 0.')
106112
self.adjusted = adjusted
107113

108114
allowed_multioutput = ('raw_values', 'uniform_average', 'variance_weighted')

0 commit comments

Comments
 (0)