credit.losses.logcosh#
Classes#
Log-Cosh Loss Function. |
Module Contents#
- class credit.losses.logcosh.LogCoshLoss(reduction='mean')#
Bases:
torch.nn.ModuleLog-Cosh Loss Function.
This loss function computes the logarithm of the hyperbolic cosine of the prediction error. It is less sensitive to outliers compared to the Mean Squared Error (MSE) loss.
- 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(y_t, y_prime_t)#
Forward pass for Log-Cosh loss.
- Parameters:
y_t (torch.Tensor) – Target tensor.
y_prime_t (torch.Tensor) – Predicted tensor.
- Returns:
Log-Cosh loss value.
- Return type:
torch.Tensor