credit.losses.msle#

Classes#

MSLELoss

Mean Squared Logarithmic Error (MSLE) Loss Function.

Module Contents#

class credit.losses.msle.MSLELoss(reduction='mean')#

Bases: torch.nn.Module

Mean Squared Logarithmic Error (MSLE) Loss Function.

This loss function computes the mean squared logarithmic error between the predicted and target values. It is useful for handling targets that span several orders of magnitude.

Parameters:

reduction (str) – Specifies the reduction to apply to the output. ‘mean’ | ‘none’. ‘mean’: the output is averaged; ‘none’: no reduction is applied.

reduction = 'mean'#
forward(prediction, target)#

Forward pass for MSLE loss.

Parameters:
  • prediction (torch.Tensor) – Predicted tensor.

  • target (torch.Tensor) – Target tensor.

Returns:

MSLE loss value.

Return type:

torch.Tensor