Pytorch:
import torch.nn.functional as F
F.mse_loss(y_pred, y_target)
# smoothly switches from l1 to l2 loss for small differnces
F.smooth_l1_loss(y_pred, y_target)
Advantages to MAE:
- Emphasizes larger errors.
- Smoother (no .abs())
Disadvantages:
- Might not be as robust to outliers