pytorch_lightning.metrics.regression module¶
-
class
pytorch_lightning.metrics.regression.
MAE
(reduction='elementwise_mean')[source]¶ Bases:
pytorch_lightning.metrics.metric.Metric
Computes the root mean absolute loss or L1-loss.
Example
>>> pred = torch.tensor([0., 1, 2, 3]) >>> target = torch.tensor([0., 1, 2, 2]) >>> metric = MAE() >>> metric(pred, target) tensor(0.2500)
- Parameters
reduction¶ (
str
) – a method for reducing mse over labels (default: takes the mean) Available reduction methods: - elementwise_mean: takes the mean - none: pass array - sum: add elements
-
class
pytorch_lightning.metrics.regression.
MSE
(reduction='elementwise_mean')[source]¶ Bases:
pytorch_lightning.metrics.metric.Metric
Computes the mean squared loss.
Example
>>> pred = torch.tensor([0., 1, 2, 3]) >>> target = torch.tensor([0., 1, 2, 2]) >>> metric = MSE() >>> metric(pred, target) tensor(0.2500)
- Parameters
reduction¶ (
str
) – a method for reducing mse over labels (default: takes the mean) Available reduction methods: - elementwise_mean: takes the mean - none: pass array - sum: add elements
-
class
pytorch_lightning.metrics.regression.
PSNR
(data_range=None, base=10, reduction='elementwise_mean')[source]¶ Bases:
pytorch_lightning.metrics.metric.Metric
Computes the peak signal-to-noise ratio
Example
>>> pred = torch.tensor([[0.0, 1.0], [2.0, 3.0]]) >>> target = torch.tensor([[3.0, 2.0], [1.0, 0.0]]) >>> metric = PSNR() >>> metric(pred, target) tensor(2.5527)
- Parameters
-
class
pytorch_lightning.metrics.regression.
RMSE
(reduction='elementwise_mean')[source]¶ Bases:
pytorch_lightning.metrics.metric.Metric
Computes the root mean squared loss.
Example
>>> pred = torch.tensor([0., 1, 2, 3]) >>> target = torch.tensor([0., 1, 2, 2]) >>> metric = RMSE() >>> metric(pred, target) tensor(0.5000)
- Parameters
reduction¶ (
str
) – a method for reducing mse over labels (default: takes the mean) Available reduction methods: - elementwise_mean: takes the mean - none: pass array - sum: add elements
-
class
pytorch_lightning.metrics.regression.
RMSLE
(reduction='elementwise_mean')[source]¶ Bases:
pytorch_lightning.metrics.metric.Metric
Computes the root mean squared log loss.
Example
>>> pred = torch.tensor([0., 1, 2, 3]) >>> target = torch.tensor([0., 1, 2, 2]) >>> metric = RMSLE() >>> metric(pred, target) tensor(0.0207)
- Parameters
reduction¶ (
str
) – a method for reducing mse over labels (default: takes the mean) Available reduction methods: - elementwise_mean: takes the mean - none: pass array - sum: add elements