Skip to content

loss function

A loss function is a scalar objective that measures the discrepancy between a model’s predictions and the target data, providing the signal that guides the parameter updates during training.

Common choices include mean squared error for regression, cross-entropy or negative log-likelihood for classification, and margin-based or contrastive objectives for ranking and metric learning.

The training objective often combines a task loss with regularization terms to control complexity. Properties such as differentiability, calibration behavior, and robustness to outliers influence optimization dynamics and generalization. Variants like class weighting, focal loss, or label smoothing adapt the signal to data imbalance or noise.

Stochastic Gradient Descent Algorithm With Python and NumPy

Tutorial

Stochastic Gradient Descent Algorithm With Python and NumPy

In this tutorial, you'll learn what the stochastic gradient descent algorithm is, how it works, and how to implement it with Python and NumPy.

advanced algorithms machine-learning numpy

For additional information on related topics, take a look at the following resources:


By Leodanis Pozo Ramos • Updated Aug. 28, 2026