pytorch_lightning.metrics.functional.regression module¶
-
pytorch_lightning.metrics.functional.regression.
mae
(pred, target, reduction='elementwise_mean')[source]¶ Computes mean absolute error
- Parameters
- Return type
- Returns
Tensor with MAE
Example
>>> x = torch.tensor([0., 1, 2, 3]) >>> y = torch.tensor([0., 1, 2, 2]) >>> mae(x, y) tensor(0.2500)
-
pytorch_lightning.metrics.functional.regression.
mse
(pred, target, reduction='elementwise_mean')[source]¶ Computes mean squared error
- Parameters
- Return type
- Returns
Tensor with MSE
Example
>>> x = torch.tensor([0., 1, 2, 3]) >>> y = torch.tensor([0., 1, 2, 2]) >>> mse(x, y) tensor(0.2500)
-
pytorch_lightning.metrics.functional.regression.
psnr
(pred, target, data_range=None, base=10.0, reduction='elementwise_mean')[source]¶ Computes the peak signal-to-noise ratio
- Parameters
- Return type
- Returns
Tensor with PSNR score
Example
>>> from pytorch_lightning.metrics.regression import PSNR >>> 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)
-
pytorch_lightning.metrics.functional.regression.
rmse
(pred, target, reduction='elementwise_mean')[source]¶ Computes root mean squared error
- Parameters
- Return type
- Returns
Tensor with RMSE
>>> x = torch.tensor([0., 1, 2, 3]) >>> y = torch.tensor([0., 1, 2, 2]) >>> rmse(x, y) tensor(0.5000)
-
pytorch_lightning.metrics.functional.regression.
rmsle
(pred, target, reduction='elementwise_mean')[source]¶ Computes root mean squared log error
- Parameters
- Return type
- Returns
Tensor with RMSLE
Example
>>> x = torch.tensor([0., 1, 2, 3]) >>> y = torch.tensor([0., 1, 2, 2]) >>> rmsle(x, y) tensor(0.0207)