EN - FR - DE - ES - IT - PT -

LexiconDream

📏 Loss Function

A function that measures the difference between predicted and actual values.

Loss Function

Training needs a score. The loss function measures how wrong a model's predictions are, giving the optimizer something to minimize. Cross-entropy for classification. Mean squared error for regression. Custom losses for specialized tasks.

The choice shapes behaviour. A model trained on cross-entropy learns calibrated probabilities. One trained on hinge loss learns a margin. Two models with identical architectures and data can behave very differently depending on what you ask them to minimize.

Common loss functions

Imbalanced data complicates loss. A classifier trained on cross-entropy will favour the majority class unless weights are adjusted. Focal loss and class weighting address the issue, at the cost of additional tuning.

Comments (3)

  1. Data scientist
    Custom ones can help for specific problems but the standard ones cover most cases well.
  2. ML engineer
    Measures how far the predictions are from reality. Choosing the right one changes training behavior a lot.
  3. Student Kai
    MSE versus cross-entropy still feels abstract until you see the gradients in action.

Leave a comment