At the heart of every machine learning algorithm lies a cost function (also called a loss function or objective function). It is the compass that guides learning: a mathematical measure of how far the model's predictions are from the true targets. Closely related to cost functions are distance metrics, which quantify the similarity or dissimilarity between data points. While cost functions are used to train models, distance metrics are used for clustering, retrieval, and as building blocks for many cost functions. This article presents a comprehensive taxonomy of both cost functions and distance metrics, from the simplest Euclidean distance to complex, task-specific objectives used in state-of-the-art deep learning, with real-world examples and references throughout.
What are Cost Functions and Distance Metrics?
A cost function is a function that maps a set of predictions and corresponding ground-truth labels to a scalar value that represents the "cost" or "error" of the model. The learning algorithm then adjusts the model's parameters to minimize this cost. A distance metric, on the other hand, is a function that quantifies the similarity or dissimilarity between two data points. Many cost functions are built on top of distance metrics; for example, the Mean Squared Error is the average of squared Euclidean distances between predictions and targets.
The diagram in Fig 1 illustrates the relationship between distance metrics and cost functions in the learning pipeline. Distance metrics provide the raw similarity measures, while cost functions aggregate these measures to produce a scalar error that can be optimized.
This diagram illustrates the fundamental relationship between distance metrics and cost functions. The input data flows through the model (with parameters θ) to produce a prediction ŷ. The distance metric measures the dissimilarity between the prediction and the true target y. The cost function aggregates these distance measures across all samples to produce a scalar error. This error is then backpropagated through the model, and the gradients are used to update the parameters in a direction that reduces the cost. The choice of distance metric determines what "similarity" means for the task, while the cost function determines how these similarities are aggregated and optimized.
The mathematical backbone of both cost functions and distance metrics is rooted in metric spaces and information theory. A proper distance metric must satisfy four properties: non-negativity, identity of indiscernibles, symmetry, and the triangle inequality. Many cost functions, such as MSE and Cross-Entropy, are derived from distance metrics but may not satisfy all metric properties, as they are designed for optimization rather than geometry. The following sections explore the full taxonomy of both distance metrics and cost functions.
Foundations: Properties of Distance Metrics
A function d(x, y) is a valid distance metric if it satisfies the following four properties for all points x, y, and z in the space:
- Non-negativity: d(x, y) ≥ 0, and d(x, y) = 0 if and only if x = y.
- Symmetry: d(x, y) = d(y, x).
- Triangle Inequality: d(x, z) ≤ d(x, y) + d(y, z).
These properties ensure that the distance function behaves intuitively and can be used to define a metric space. Many common distance metrics, such as Euclidean and Manhattan distances, satisfy all four properties. However, some useful measures, such as the Kullback-Leibler divergence and cosine distance, violate one or more of these properties (e.g., KL divergence is not symmetric and does not satisfy the triangle inequality). These are often called divergences or dissimilarity measures rather than metrics.
0. Distance Metrics: The Foundation of Similarity and Discrepancy
Distance metrics are the foundation upon which many cost functions are built. They quantify the similarity or dissimilarity between data points, and they are used in clustering, retrieval, dimensionality reduction, and as building blocks for cost functions. This section provides a comprehensive taxonomy of distance metrics, from the most common (Euclidean, Manhattan) to more specialized measures (Mahalanobis, Levenshtein, Cosine). Understanding these metrics is essential for selecting the right cost function and for interpreting the behavior of machine learning models.
The diagram in Fig 2 visualizes the relationship between different distance metrics and their properties. Each metric is suited for different types of data and applications, and the choice of metric can significantly impact the performance of the model.
This figure provides a comprehensive overview of the major distance metrics used in machine learning. Each metric is designed for a specific type of data and application. Euclidean and Manhattan distances are the most common for continuous feature spaces. Mahalanobis distance accounts for correlations between features, making it useful for multivariate data. Cosine distance is widely used in text processing and high-dimensional sparse data. Levenshtein distance is the standard for string comparison, while Jaccard and Hamming distances are used for sets and binary data. The Earth Mover's (Wasserstein) distance is used for distributions, and KL Divergence, while not a true metric, is fundamental in information theory. The choice of distance metric can significantly impact model performance and must be carefully considered.
0.1 Euclidean Distance (L2 Norm)
The Euclidean distance (also called the L2 norm) is the most common distance metric. It measures the straight-line distance between two points in Euclidean space:
Euclidean distance satisfies all four metric properties. It is intuitive and widely used in clustering (K-means), nearest neighbor search (KNN), and as the basis for the Mean Squared Error cost function. However, Euclidean distance is sensitive to the scale of the features and can be dominated by large values. It also performs poorly in high-dimensional spaces due to the curse of dimensionality, where the distance between points becomes less discriminative. In such cases, other metrics like cosine distance or Mahalanobis distance may be preferred.
Applications: K-means clustering, KNN classification, image retrieval, and as the basis for MSE loss. In wireless communications, the Normalized Mean Squared Error (NMSE) is used as a loss function for training neural networks in signal processing applications (Wang et al., 2020). Euclidean distance is also the standard metric for evaluating regression models in housing price prediction.
0.2 Manhattan Distance (L1 Norm)
The Manhattan distance (also called the L1 norm or city block distance) measures the sum of absolute differences between two points:
Manhattan distance is less sensitive to outliers than Euclidean distance because it does not square the differences. It is the natural distance in grid-like spaces and is used in applications like pathfinding and robotics. Manhattan distance is the basis for the Mean Absolute Error (MAE) cost function. Like Euclidean distance, it satisfies all four metric properties but is also sensitive to feature scaling. It is often preferred when the data has many outliers or when the features are independent and the contribution of each feature should be treated equally.
Applications: Pathfinding, robotics, robust regression (MAE), and as the basis for the Mean Absolute Error cost function. In YOLO object detection, L1 loss is used for bounding box regression to penalize localization errors for the width and height coordinates. The Balanced L1 Loss, an enhanced version, improves robustness and accuracy when object sizes vary significantly (Redmon & Farhadi, 2018). Manhattan distance is also used in radiation therapy dose prediction models like DeepDoseNet (Fan et al., 2019).
0.3 Minkowski Distance
The Minkowski distance is a generalization of both Euclidean and Manhattan distances:
When p = 1, it becomes Manhattan distance; when p = 2, it becomes Euclidean distance. The Minkowski distance is a valid metric for all p ≥ 1. The parameter p controls the sensitivity to large differences; larger values of p emphasize larger differences more strongly. For p → ∞, it becomes the Chebyshev distance, which measures the maximum absolute difference between coordinates. The Minkowski distance is used in various applications where the choice of p allows tuning the sensitivity to outliers and feature scales.
Applications: Generalized nearest neighbor search, clustering with tunable sensitivity to outliers, and distance-based anomaly detection where p can be optimized for the specific data distribution.
0.4 Mahalanobis Distance
The Mahalanobis distance accounts for correlations between features and is scale-invariant:
where S is the covariance matrix of the data. The Mahalanobis distance is particularly useful when the features are correlated and have different scales. It effectively transforms the data into a space where the features are uncorrelated and have unit variance, making the distance measure more meaningful. Mahalanobis distance is used in anomaly detection, multivariate outlier detection, and as a basis for some cost functions. It satisfies all four metric properties when S is positive definite.
Applications: Anomaly detection, multivariate outlier detection, multivariate analysis, and metric learning. In industrial quality control, Mahalanobis distance is used to detect defective products by measuring their deviation from the normal distribution of features (Taguchi & Jugulum, 2002). It is also used in financial fraud detection to identify suspicious transactions that deviate from normal patterns.
0.5 Cosine Similarity and Cosine Distance
The cosine similarity measures the cosine of the angle between two vectors:
The cosine distance is then defined as:
Cosine distance is not a true metric because it does not satisfy the triangle inequality in all cases. However, it is widely used in text processing and high-dimensional sparse data because it is insensitive to the magnitude of the vectors and only considers their direction. This makes it ideal for comparing documents represented as TF-IDF vectors or word embeddings. Cosine distance is used in many information retrieval systems and as a similarity measure in recommendation systems. It is also the basis for some contrastive losses in deep learning.
Applications: Text retrieval, document similarity, recommendation systems, and as a similarity measure in metric learning. In movie recommendation systems, cosine similarity is the primary metric used in KNN-based recommenders, comparing user or item vectors to find similar users or movies (Sarwar et al., 2001). Cosine similarity is also used in hybrid loss functions that combine Bayesian Personalized Ranking with cosine similarity for more accurate recommendations.
0.6 Levenshtein Distance (Edit Distance)
The Levenshtein distance (also called edit distance) measures the minimum number of single-character edits (insertions, deletions, or substitutions) required to transform one string into another. It is defined recursively as:
For two strings a and b of lengths m and n, the Levenshtein distance L(a, b) is:
where if and 1 otherwise. The Levenshtein distance is a true metric and is widely used in spell checking, DNA sequence alignment, and natural language processing. It is computationally expensive for long strings (O(mn)), but efficient implementations exist using dynamic programming.
Applications: Spell checking, DNA sequence alignment, natural language
processing, and approximate string matching. The pyspellchecker library
uses Levenshtein Distance (up to edit distance 2) to find candidate corrections for
misspelled words (Barr, 2020). Spell-checkers like Ispell suggest words with an
edit distance of 1. In legal technology, systems have been proposed to automatically
correct misused legal terms using the Levenshtein Edit Distance algorithm. It is
also used in duplicate address detection (e.g., "931 Main St" vs "931 Main Street").
0.7 Hamming Distance
The Hamming distance measures the number of positions at which two strings of equal length differ. For binary strings, it counts the number of differing bits:
The Hamming distance is a true metric and is widely used in coding theory, error detection and correction, and in some machine learning applications where data is represented as binary vectors. It is computationally efficient and can be computed quickly using bitwise operations. Hamming distance is also used in some classification algorithms and as a similarity measure for binary features.
Applications: Error detection and correction, binary classification, DNA sequence analysis, and image hashing. In coding theory, Hamming distance is used to design error-correcting codes that can detect and correct bit errors (Hamming, 1950). It is also used in perceptual hashing algorithms for near-duplicate image detection, where the Hamming distance between hash codes indicates visual similarity.
0.8 Jaccard Distance
The Jaccard distance measures the dissimilarity between two sets. It is defined as:
The Jaccard distance is a true metric and is widely used in set-based applications such as document similarity, recommendation systems, and image segmentation. It measures the proportion of elements that are not shared between the two sets. Jaccard distance is particularly useful when the data is represented as sets of features or as binary vectors. It is also used in clustering algorithms and as a similarity measure in information retrieval.
Applications: Document similarity, recommendation systems, image segmentation, and set-based clustering. In information retrieval, Jaccard distance is used to measure the overlap between sets of words or n-grams in documents, enabling near-duplicate detection. In recommendation systems, it compares the sets of items rated by different users to find similar users for collaborative filtering.
0.9 Earth Mover's Distance (Wasserstein Distance)
The Earth Mover's Distance (also called the 1-Wasserstein distance) measures the minimum cost of transforming one probability distribution into another:
The Earth Mover's distance is a true metric and is used in a variety of applications, including image retrieval, generative modeling (WGAN), and domain adaptation. It is computationally expensive to compute exactly, but efficient approximations exist. The Wasserstein distance is particularly useful in generative modeling because it provides meaningful gradients even when the distributions have disjoint support, unlike KL divergence.
Applications: Generative modeling (WGAN), image retrieval, domain adaptation, and histogram comparison. In the Industrial Internet of Things (IIoT), WGAN with Wasserstein distance is used for anomaly detection to generate high-fidelity minority samples (Li et al., 2021). In image retrieval, the Earth Mover's distance is used to compare histograms and probability distributions. The Wasserstein GAN (WGAN) uses the 1-Wasserstein distance as its loss function, leading to more stable training than standard GANs (Arjovsky et al., 2017).
0.10 Kullback-Leibler Divergence
The Kullback-Leibler (KL) divergence measures the information loss when using distribution Q to approximate distribution P:
KL divergence is not a true metric because it is asymmetric and does not satisfy the triangle inequality. However, it is fundamental in information theory and is used extensively in machine learning, particularly in variational autoencoders (VAEs) and in knowledge distillation. KL divergence measures the amount of information lost when Q is used to approximate P. It is non-negative and equals zero only when P = Q.
Applications: Variational autoencoders, knowledge distillation, model evaluation, and information theory. In transfer learning, KL divergence is used as a regularization loss to guide model fine-tuning and quantify domain discrepancy in data-driven applications like shield tunneling (Zhang et al., 2021). It is also used in drift detection where autoencoder-based models incorporate KL divergence as an additional loss term to detect changes in data distribution. In knowledge distillation, the student model is trained to minimize the KL divergence between its output distribution and that of the teacher model (Hinton et al., 2015).
0.11 Jensen-Shannon Divergence
The Jensen-Shannon divergence is a symmetric version of KL divergence:
where . JSD is symmetric, non-negative, and bounded between 0 and log(2). It is used in generative adversarial networks (GANs) and as a distance measure in clustering and model comparison.
Applications: Generative adversarial networks, clustering, and model comparison. In GANs, JSD is used to measure the similarity between the generated distribution and the real data distribution, providing a more stable and interpretable divergence than KL (Goodfellow et al., 2014). It is also used in clustering to measure the distance between clusters and in the evaluation of probabilistic models.
0.12 Comparing Distance Metrics
Table 1 provides a comprehensive comparison of the major distance metrics, their properties, and their typical applications. The choice of distance metric can significantly impact the performance of machine learning models, and it is essential to select the metric that is best suited for the data and the task.
| Metric | Formula | Metric? (Properties) | Data Type | Common Applications |
|---|---|---|---|---|
| Euclidean (L2) | √Σ(x-y)² | Yes (all 4) | Continuous | K-means, KNN, MSE loss, wireless NMSE |
| Manhattan (L1) | Σ|x-y| | Yes (all 4) | Continuous | MAE loss, YOLO box regression, pathfinding |
| Minkowski | (Σ|x-y|^p)^(1/p) | Yes (for p ≥ 1) | Continuous | Generalized nearest neighbor |
| Mahalanobis | √((x-y)ᵀ S⁻¹(x-y)) | Yes (if S positive definite) | Continuous (correlated) | Anomaly detection, quality control, metric learning |
| Cosine Distance | 1 - (x·y)/(||x||||y||) | No (fails triangle inequality) | High-dimensional sparse | Text retrieval, movie recommendation, embeddings |
| Levenshtein | Edit distance (DP) | Yes (all 4) | String | Spell checking, DNA alignment, legal term correction |
| Hamming | Σ(x_i ≠ y_i) | Yes (all 4) | Binary | Error correction, binary classification, image hashing |
| Jaccard | 1 - |A∩B|/|A∪B| | Yes (all 4) | Set | Document similarity, recommendation, segmentation |
| Earth Mover's (Wasserstein) | Optimal transport | Yes (all 4) | Distribution | WGAN, IIoT anomaly detection, domain adaptation |
| KL Divergence | ΣP log(P/Q) | No (asymmetric) | Distribution | VAE, knowledge distillation, transfer learning |
| Jensen-Shannon | ½KL(P||M)+½KL(Q||M) | Yes (symmetric) | Distribution | GANs, clustering, model comparison |
Table 1: Comparison of distance metrics. The table summarizes the formula, metric properties, data type suitability, and common applications. Euclidean and Manhattan are the most widely used for continuous data. Mahalanobis is preferred when features are correlated. Cosine is the go‑to for high‑dimensional sparse data like text. Levenshtein, Hamming, and Jaccard are used for strings, binary, and set data respectively. Earth Mover’s and KL divergence are used for distributions, with KL being asymmetric and thus not a true metric. The choice of distance metric should be guided by the nature of the data and the requirements of the task.
Table 1 provides a comprehensive comparison of the major distance metrics and divergences used in machine learning. The table summarizes the formula, the metric properties (whether it satisfies non-negativity, symmetry, and the triangle inequality), the data type it is best suited for, and the common applications. As shown, Euclidean and Manhattan distances are the most widely used for continuous data. Mahalanobis distance is preferred when features are correlated. Cosine distance is the go-to for high-dimensional sparse data like text. Levenshtein, Hamming, and Jaccard distances are used for strings, binary, and set data respectively. Earth Mover's and KL divergence are used for distributions, with KL divergence being asymmetric and thus not a true metric. The choice of distance metric should be guided by the nature of the data and the requirements of the task.
1. Regression Losses: Continuous Targets
Regression losses are used when the target variable is continuous (e.g., house prices, temperature, stock returns). The goal is to minimize the difference between the predicted value and the true value. The most common regression losses are the Mean Squared Error (MSE), the Mean Absolute Error (MAE), and the Huber Loss, which combines the best of both. The choice among these depends on the distribution of the target variable and the sensitivity to outliers.
The diagram in Fig 3 compares the behavior of MSE, MAE, and Huber loss as a function of the prediction error. MSE grows quadratically, heavily penalizing large errors. MAE grows linearly, making it more robust to outliers. Huber loss is quadratic for small errors and linear for large errors, providing a smooth transition between the two regimes.
This figure illustrates the key differences between the three most common regression losses. The Mean Squared Error (MSE) curve (blue) is a parabola: as the prediction error grows, the loss grows quadratically. This means that a single large error (outlier) can dominate the total loss and pull the model significantly off course. The Mean Absolute Error (MAE) curve (orange) is V-shaped, growing linearly with the error. This makes MAE much more robust to outliers, as a large error contributes only linearly to the total loss. The Huber loss (green) combines both: it is quadratic for small errors (providing smooth gradients) and linear for large errors (providing robustness). The transition point is controlled by the hyperparameter δ, which is shown here as 1.0. The choice among these losses depends on the presence of outliers in the data and the desired sensitivity to large errors.
1.1 Mean Squared Error (MSE)
The Mean Squared Error (MSE) is defined as:
It is the most widely used regression loss. MSE is the average of the squared differences between the predicted and true values. It is differentiable, convex, and has a well-defined gradient.
Mathematical properties: MSE is the maximum likelihood estimator for the parameters of a linear model when the errors are assumed to be normally distributed (Gaussian). It is also the minimum-variance unbiased estimator for the mean of a Gaussian distribution. The quadratic penalty means that MSE is sensitive to outliers; a single point with a large error can dominate the loss. This can be beneficial when large errors are particularly undesirable (e.g., in financial forecasting, where a large prediction error can lead to significant losses), but it can also cause the model to overfit to outliers. MSE is also used in the training of autoencoders and many other deep learning models, often combined with regularization to prevent overfitting.
Real-World Applications: Linear regression, house price prediction, weather forecasting, and corrosion rate prediction. MSE is used as the loss function in models for predicting temperature, precipitation, and marine heatwaves. In corrosion engineering, MSE is used to train neural networks for predicting corrosion rates (Wang et al., 2020). In wireless communications, the Normalized Mean Squared Error (NMSE) is used as a loss function for training neural networks in signal processing applications.
1.2 Mean Absolute Error (MAE)
The Mean Absolute Error (MAE) is defined as:
MAE is the average of the absolute differences between predictions and targets. It is less sensitive to outliers than MSE because the gradient is constant. This constant gradient means that MAE is more robust to outliers but has a discontinuity at zero, which can cause instability in gradient-based optimization.
Mathematical properties: MAE is the maximum likelihood estimator for the parameters of a linear model when the errors are assumed to follow a Laplace distribution. The median is the optimal predictor under MAE, making it a natural choice when the data contains many outliers. However, the non-differentiability at zero can be problematic for optimization; sub-gradients are often used instead. In practice, MAE is preferred when the data contains significant outliers and the goal is to produce a robust model that is not overly influenced by extreme values.
Real-World Applications: Radiation therapy dose prediction, financial forecasting, and robust regression modeling. DeepDoseNet, a deep learning model for 3D dose prediction in radiation therapy, uses MAE as its loss function to achieve accurate and robust predictions (Fan et al., 2019). MAE is also used in TensorFlow and Keras models for evaluating performance on real-world regression data with outliers.
1.3 Huber Loss
The Huber Loss (also called the Smooth L1 Loss) combines the best of MSE and MAE. It is quadratic for small errors and linear for large errors:
The hyperparameter δ controls the transition point between the quadratic and linear regimes. Huber loss is differentiable everywhere, making it suitable for gradient-based optimization. It is less sensitive to outliers than MSE but provides a smoother gradient than MAE.
Mathematical properties: The Huber loss is a robust estimator that combines the advantages of MSE and MAE. For errors smaller than δ, it behaves like MSE, providing a smooth gradient and quadratic convergence. For errors larger than δ, it behaves like MAE, providing robustness to outliers. The transition is smooth because the derivative is continuous at δ. The choice of δ is critical: a small δ makes the loss behave more like MAE, while a large δ makes it behave more like MSE. Huber loss is often used in regression tasks where outliers are expected but the model should still be sensitive to small errors.
Real-World Applications: Parameter estimation in nonlinear systems, robust regression, and Boston housing price prediction. Huber loss-guided neural networks are used for parameter estimation, effectively uncovering complex relationships in nonlinear systems (Chen et al., 2019). In time series trend filtering, Huber loss is adopted to suppress outliers while capturing both slow and abrupt trend changes. It is also used with Keras to create regression models robust to outliers on the Boston Housing dataset.
1.4 Log-Cosh Loss
The Log-Cosh Loss is another smooth approximation to MAE that is less sensitive to outliers than MSE:
For large errors, log-cosh behaves like MAE. For small errors, it behaves like MSE. It is twice differentiable and provides a smooth, robust alternative to Huber loss.
Mathematical properties: The log-cosh function is the logarithm of the hyperbolic cosine of the error. It is a smooth, convex function that is approximately quadratic near zero and approximately linear for large errors. Unlike Huber loss, which has a piecewise definition, log-cosh is a single, smooth function that is twice differentiable everywhere. This makes it easier to use in automatic differentiation frameworks and can lead to more stable optimization. The log-cosh loss is often used in regression tasks where robustness to outliers is desired but a smoother gradient than Huber is preferred.
Real-World Applications: Regression tasks with outliers, deep learning applications where a twice-differentiable robust loss is needed, and time-series forecasting with heavy-tailed error distributions.
1.5 Quantile Loss
The Quantile Loss (also called the Pinball Loss) is used for quantile regression, where the goal is to predict a specific quantile of the conditional distribution:
where is the desired quantile. For , it reduces to MAE. For , over-predictions are penalized more heavily, making the model conservative.
Mathematical properties: Quantile loss is a linear loss function that is asymmetric when q ≠ 0.5. It is used to estimate the conditional quantiles of the target distribution, which provides a more complete picture of the uncertainty than a point estimate. For example, in financial risk management, predicting the 95th percentile of a loss distribution is crucial for Value-at-Risk (VaR) calculations. Quantile loss is also used in ensemble methods and in the construction of prediction intervals.
Real-World Applications: Financial risk management (Value-at-Risk), uncertainty quantification, and ensemble methods. Quantile loss is used in quantile regression forests and gradient boosting to construct prediction intervals and estimate the uncertainty of predictions in domains like energy forecasting and climate modeling.
Applications
- House price prediction (MSE).
- Robust regression with outliers (MAE, Huber).
- Quantile regression for risk management (Quantile Loss).
- Time-series forecasting (Log-Cosh).
- Radiation therapy dose prediction (MAE).
Strengths and limitations
| Strengths | Limitations |
|---|---|
| MSE is smooth and convex. | MSE is sensitive to outliers. |
| MAE is robust to outliers. | MAE is non-differentiable at zero. |
| Huber combines robustness with smoothness. | Huber requires tuning δ. |
| Quantile loss provides distributional information. | Quantile loss is asymmetric for q ≠ 0.5. |
Table 3: Strengths and limitations of regression losses. MSE is smooth and convex but highly sensitive to outliers. MAE is robust to outliers but non‑differentiable at zero. Huber combines robustness with smoothness but requires tuning the δ hyperparameter. Quantile loss provides distributional information but is asymmetric for q ≠ 0.5. The choice depends on the presence of outliers and the need for smooth gradients.
2. Classification Losses: Discrete Targets
Classification losses are used when the target variable is discrete (e.g., class labels). The goal is to minimize the discrepancy between the predicted class probabilities and the true class labels. The most common classification loss is Cross-Entropy Loss (also called Log Loss), which measures the dissimilarity between the predicted probability distribution and the true distribution. Other classification losses include Hinge Loss (used in Support Vector Machines) and Focal Loss (designed to address class imbalance).
The diagram in Fig 4 illustrates the behavior of cross-entropy loss as a function of the predicted probability for a binary classification problem. When the true label is 1, the loss approaches zero as the predicted probability approaches 1, and increases to infinity as the predicted probability approaches 0. This logarithmic penalty encourages the model to make confident predictions.
This figure demonstrates the behavior of cross-entropy loss for binary classification. When the true label is 1, the loss is -log(ŷ). As the predicted probability ŷ approaches 1 (the model is very confident and correct), the loss approaches 0. As ŷ approaches 0 (the model is very confident but wrong), the loss approaches infinity. This logarithmic penalty strongly discourages confident but incorrect predictions. The loss at ŷ = 0.5 (random guessing) is 0.69, and at ŷ = 0.1 it is 2.30. This asymmetric penalty is what makes cross-entropy the default choice for classification tasks, as it pushes the model to make calibrated probability estimates.
2.1 Binary Cross-Entropy Loss
The Binary Cross-Entropy Loss is used for binary classification (two classes). It is defined as:
where and is the predicted probability of the positive class.
Mathematical properties: Binary cross-entropy is a convex function of the logits (pre-activation values) and is the standard loss for binary classification in neural networks. It is derived from the maximum likelihood principle: the model outputs a probability, and the loss measures how well this probability matches the observed binary label. The gradient with respect to the logits is simple and well-behaved, making it compatible with gradient-based optimization.
Real-World Applications: Logistic regression, spam detection, medical diagnosis (chest X-ray classification), and YOLO object detection (used for objectness loss and classification loss). Binary cross-entropy is the standard loss for training models to detect masses in chest X-rays and for classifying emails as spam or not spam.
2.2 Categorical Cross-Entropy Loss
The Categorical Cross-Entropy Loss generalizes binary cross-entropy to multi-class classification (more than two classes). It is defined as:
where is 1 if the sample belongs to class c, and 0 otherwise, and is the predicted probability for class c.
Mathematical properties: Categorical cross-entropy is the negative log likelihood of the multinomial distribution. It is the standard loss for multi-class classification in deep learning. The softmax activation ensures that the outputs sum to 1 and are positive, forming a valid probability distribution. The gradient with respect to the logits is simple and well-behaved, making it compatible with backpropagation.
Real-World Applications: Image classification (ResNet, EfficientNet, Vision Transformers on ImageNet), multi-class classification (digit recognition, species classification), and remote sensing (parcel-level crop classification and risk prioritization). Categorical cross-entropy is the default loss for training state-of-the-art image classification models.
2.3 Sparse Cross-Entropy Loss
The Sparse Categorical Cross-Entropy Loss is a variant of categorical cross-entropy that uses integer class labels instead of one-hot encoded vectors. The loss is the same as categorical cross-entropy, but the labels are provided as integers (0, 1, 2, ..., C-1) instead of one-hot vectors.
Mathematical properties: Sparse cross-entropy is equivalent to categorical cross-entropy but is more memory-efficient because it avoids storing the one-hot encoded matrix. This is particularly useful for large datasets with many classes. The gradient is the same as for categorical cross-entropy, and the loss function is convex with respect to the logits.
Real-World Applications: Large-scale classification (language modeling with large vocabularies), deep learning frameworks (TensorFlow and PyTorch default for multi-class classification with integer labels). Sparse cross-entropy is used in NLP tasks like language modeling where the vocabulary size can be hundreds of thousands of tokens.
2.4 Hinge Loss (SVM Loss)
The Hinge Loss is used in Support Vector Machines (SVMs) and is defined as:
where is the true label and is the raw output (logit) of the model.
Mathematical properties: Hinge loss is convex but not differentiable at the point where . Sub-gradients are used for optimization. The loss is designed to maximize the margin between classes, which leads to the well-known SVM formulation.
Real-World Applications: Support Vector Machines (SVMs), text classification (document categorization), and image classification (SVMs were popular before deep learning). Hinge loss with SVMs is used in linear classifiers for text categorization and in kernel-based methods for non-linear classification.
2.5 Squared Hinge Loss
The Squared Hinge Loss is a variant of hinge loss that squares the error:
Squared hinge loss is differentiable everywhere and is smoother than hinge loss. It penalizes margin violations quadratically.
Mathematical properties: Squared hinge loss is convex and smooth, which makes it easier to optimize than regular hinge loss. It is often used in Support Vector Machines with differentiable optimization algorithms. The quadratic penalty for large margin violations makes it more sensitive to outliers than the standard hinge loss.
Real-World Applications: Differentiable SVMs, kernel methods with smooth optimization, and deep learning applications where smooth gradients are desirable.
2.6 Focal Loss
The Focal Loss was introduced to address the class imbalance problem in object detection. It is defined as:
where is the predicted probability for the true class, and is a focusing parameter.
Mathematical properties: Focal loss is a dynamically scaled cross-entropy loss that down-weights the contribution of easy examples and focuses on hard examples. This makes it particularly effective for datasets with severe class imbalance. The focusing parameter γ controls the rate at which easy examples are down-weighted. A typical value for γ is 2.
Real-World Applications: RetinaNet object detection (focal loss was specifically designed for RetinaNet), imbalanced classification (medical diagnosis, fraud detection), and white blood cell detection (γ = 2.0 delivers the highest precision). RetinaNet with focal loss matches the speed of one-stage detectors while surpassing the accuracy of two-stage detectors (Lin et al., 2017).
Applications
- Image classification (Cross-Entropy).
- Object detection (Focal Loss).
- Support Vector Machines (Hinge Loss).
- Spam detection (Binary Cross-Entropy).
Strengths and limitations
| Strengths | Limitations |
|---|---|
| Cross-entropy provides calibrated probabilities. | Cross-entropy can be over-confident. |
| Hinge loss maximizes margin. | Hinge loss does not produce probabilities. |
| Focal loss handles class imbalance effectively. | Focal loss requires tuning γ. |
| Squared hinge is smooth and differentiable. | Squared hinge is sensitive to outliers. |
Table 4: Strengths and limitations of classification losses. Cross‑entropy provides calibrated probabilities but can be over‑confident. Hinge loss maximizes the margin but does not output probabilities. Focal loss handles class imbalance effectively but requires tuning the focusing parameter γ. Squared hinge is smooth and differentiable yet remains sensitive to outliers.
3. Probabilistic Losses: Distributional Modeling
Probabilistic losses are used when the model outputs a probability distribution over the target variable, rather than a point estimate. These losses are derived from information theory and measure the divergence between the predicted distribution and the true distribution. The most common probabilistic loss is the Kullback-Leibler Divergence (KL Divergence), which measures the information loss when using the predicted distribution to approximate the true distribution.
3.1 Kullback-Leibler Divergence
The Kullback-Leibler Divergence (KL Divergence) measures the dissimilarity between two probability distributions P and Q:
KL Divergence is asymmetric and is non-negative, with equality only when P = Q.
Mathematical properties: KL Divergence is a fundamental concept in information theory and is the basis for many probabilistic loss functions. It measures the amount of information lost when Q is used to approximate P. In machine learning, KL Divergence is often used as a regularization term in variational autoencoders (VAEs) to encourage the latent distribution to be close to a prior distribution. It is also used in knowledge distillation.
Real-World Applications: Variational autoencoders (VAEs), knowledge distillation, transfer learning (KL divergence is used as a regularization loss to guide model fine-tuning), and drift detection (autoencoder-based models incorporate KL divergence to detect changes in data distribution). In knowledge distillation, the student model is trained to minimize the KL divergence between its output distribution and that of the teacher model (Hinton et al., 2015).
3.2 Jensen-Shannon Divergence
The Jensen-Shannon Divergence (JSD) is a symmetric version of KL Divergence:
where . JSD is symmetric, non-negative, and bounded between 0 and log(2).
Mathematical properties: Jensen-Shannon Divergence is a symmetric and smoothed version of KL Divergence. It is bounded between 0 and log(2), which makes it more stable and interpretable than KL Divergence. JSD is used in a variety of applications, including generative adversarial networks (GANs).
Real-World Applications: Generative adversarial networks (GANs), clustering, and model comparison. In GANs, JSD is used to measure the similarity between the generated distribution and the real data distribution (Goodfellow et al., 2014). It is also used in clustering to measure the distance between clusters.
3.3 Wasserstein Loss (Earth Mover's Distance)
The Wasserstein Loss (also called Earth Mover's Distance or Wasserstein Distance) measures the minimum cost of transforming one probability distribution into another. For two distributions P and Q, the 1-Wasserstein distance is:
Wasserstein loss is smooth and provides meaningful gradients even when the distributions have disjoint support.
Mathematical properties: Wasserstein loss is based on optimal transport theory and provides a geometrically meaningful distance between probability distributions. Unlike KL Divergence, which is undefined when the distributions have disjoint support, Wasserstein loss is well-defined for any pair of distributions and is smooth, making it ideal for training generative models.
Real-World Applications: Wasserstein GAN (WGAN) uses the 1-Wasserstein distance for more stable training (Arjovsky et al., 2017), IIoT anomaly detection (WGAN is used to generate high-fidelity minority samples), domain adaptation, and image retrieval. In the Industrial Internet of Things (IIoT), WGAN with Wasserstein distance is used for anomaly detection (Li et al., 2021).
3.4 Negative Log-Likelihood (NLL)
The Negative Log-Likelihood (NLL) is a general-purpose loss for probabilistic models. For a model that outputs a probability distribution over the target variable, the NLL is:
NLL is the negative logarithm of the likelihood of the data given the model parameters. Minimizing NLL is equivalent to maximizing the likelihood.
Mathematical properties: NLL is the foundational loss for all maximum likelihood estimation (MLE) methods. It is a general framework that encompasses many other loss functions as special cases. For example, when the model assumes a Gaussian distribution for the target, NLL reduces to MSE. When the model assumes a Bernoulli distribution, NLL reduces to binary cross-entropy. NLL is the default training objective for many deep learning models, including language models.
Real-World Applications: Language modeling (GPT, LLaMA), maximum likelihood estimation, and speech recognition (acoustic models with CTC loss). NLL is the standard loss for training autoregressive language models.
Applications
- Variational autoencoders (KL Divergence).
- Generative adversarial networks (Wasserstein Loss).
- Language modeling (Negative Log-Likelihood).
- Knowledge distillation (KL Divergence).
Strengths and limitations
| Strengths | Limitations |
|---|---|
| KL Divergence has a strong information-theoretic foundation. | KL Divergence is asymmetric. |
| JSD is symmetric and bounded. | JSD can be computationally expensive. |
| Wasserstein loss provides meaningful gradients. | Wasserstein loss is computationally expensive. |
| NLL is a general-purpose framework. | NLL can be sensitive to model misspecification. |
Table 5: Strengths and limitations of probabilistic losses. KL divergence has a strong information‑theoretic foundation but is asymmetric. JSD is symmetric and bounded, yet computationally more expensive. Wasserstein loss provides meaningful gradients even for disjoint supports, but exact computation is costly. NLL is a general‑purpose framework but can be sensitive to model misspecification.
4. Ranking and Pairwise Losses
Ranking losses are used when the goal is to learn a relative ordering between items, rather than an absolute prediction. These losses are common in recommender systems, information retrieval, and metric learning. The most common ranking losses are the Pairwise Ranking Loss (also called the Contrastive Loss) and the Triplet Loss, which are designed to learn embeddings where similar items are close together and dissimilar items are far apart.
This figure illustrates the triplet loss mechanism, which is widely used in metric learning and face recognition. The anchor is a reference point (e.g., an image of a person). The positive is another image of the same person, and the negative is an image of a different person. The loss aims to make the distance between the anchor and the positive smaller than the distance between the anchor and the negative by at least a margin. This encourages the model to learn embeddings where similar items are close together and dissimilar items are far apart.
4.1 Contrastive Loss (Pairwise Ranking Loss)
The Contrastive Loss (also called Pairwise Ranking Loss) is used for learning embeddings where similar items are close together and dissimilar items are far apart. For a pair of inputs (x_i, x_j) with label y (1 if similar, 0 if dissimilar):
where is the embedding of sample i, and m is a margin parameter.
Mathematical properties: The contrastive loss is a simple and effective loss for metric learning. It is convex with respect to the embedding distances and has a well-defined gradient. The margin parameter m controls the separation between similar and dissimilar pairs.
Real-World Applications: Face verification, signature verification, and SimCLR self-supervised learning (contrastive loss is used to pretrain encoders on unlabeled data). SimCLR-pretrained YOLOv8 achieves higher mAP than its supervised counterpart (Chen et al., 2020).
4.2 Triplet Loss
The Triplet Loss is a widely used metric learning loss that considers triplets of samples: an anchor, a positive (same class as anchor), and a negative (different class from anchor):
where α is the margin parameter.
Mathematical properties: The triplet loss is one of the most effective losses for learning discriminative embeddings. It is used in FaceNet for face recognition. The triplet loss is more efficient than the contrastive loss because it uses triplets instead of pairs, capturing more relational information.
Real-World Applications: FaceNet face recognition (triplet loss is the core optimization objective of FaceNet), person re-identification (matching individuals across different camera views), and image retrieval (learning embeddings where similar images are close together) (Schroff et al., 2015).
4.3 Quadruplet Loss
The Quadruplet Loss extends the triplet loss by considering four samples: an anchor, a positive, a negative, and a second negative from a different class:
The quadruplet loss enforces that the anchor-positive distance is less than the anchor-negative distance and also less than the negative-negative distance.
Mathematical properties: The quadruplet loss is an extension of the triplet loss that provides additional constraints on the embedding space. It is used in applications where fine-grained class separation is required.
Real-World Applications: Person re-identification (provides more fine-grained class separation) and fine-grained classification (used when subtle differences between classes must be preserved).
4.4 N-Pair Loss
The N-Pair Loss extends the triplet loss by considering multiple negatives for a single anchor-positive pair. It is defined as:
where the embeddings are normalized to have unit norm.
Mathematical properties: The N-Pair loss is a generalization of the triplet loss that considers multiple negatives in a single loss term. This makes it more efficient than the triplet loss, as it can be computed in a single forward pass. The N-Pair loss has been shown to achieve state-of-the-art performance in metric learning tasks.
Real-World Applications: Image retrieval (state-of-the-art metric learning), contrastive learning (the InfoNCE loss used in SimCLR and MoCo is a variant of N-Pair loss), and face recognition.
Applications
- Face recognition (Triplet Loss).
- Image retrieval (Contrastive Loss, N-Pair Loss).
- Recommender systems (Pairwise Ranking Loss).
- Person re-identification (Quadruplet Loss).
Strengths and limitations
| Strengths | Limitations |
|---|---|
| Learn discriminative embeddings. | Require careful sampling of pairs/triplets. |
| Generalize well to unseen classes. | Computationally expensive. |
| Flexible and can be adapted to many tasks. | Sensitive to hyperparameter tuning. |
Table 6: Strengths and limitations of ranking losses. They learn highly discriminative embeddings and generalize well to unseen classes. However, they require careful sampling of pairs or triplets, are computationally intensive, and are sensitive to hyperparameter tuning (margin values, batch composition).
5. Regularization Losses
Regularization losses are not used for fitting the data directly, but rather as penalty terms that encourage certain properties in the model, such as sparsity, smoothness, or small weights. They are often added to the primary loss function to prevent overfitting and improve generalization. The most common regularization losses are L1 Regularization (Lasso), L2 Regularization (Ridge), and Elastic Net, which combine both.
This figure compares the three main regularization penalties. The L1 penalty (blue) is piecewise linear and grows linearly with the absolute value of the weight. This encourages sparsity because the gradient is constant, and the optimal solution often occurs at zero. The L2 penalty (orange) is quadratic and grows with the square of the weight. This encourages small weights but does not force them to zero. The Elastic Net (green) is a combination of L1 and L2, with a parameter α controlling the balance between the two. Elastic Net encourages both sparsity and small weights.
5.1 L1 Regularization (Lasso)
L1 Regularization (also known as Lasso) adds the sum of the absolute values of the weights to the loss:
where λ is the regularization strength. L1 regularization encourages sparsity in the weights, making it useful for feature selection.
Mathematical properties: L1 regularization is a convex penalty that promotes sparsity in the model parameters. This is particularly useful in high-dimensional settings where many features are irrelevant. The L1 penalty forces some weights to exactly zero, effectively performing feature selection.
Real-World Applications: Feature selection in genomics (identifying the most relevant genes), software defect prediction (shrinking irrelevant coefficients to zero), sparse signal recovery, and diabetes dataset analysis (Lasso path visualization).
5.2 L2 Regularization (Ridge)
L2 Regularization (also known as Ridge) adds the sum of the squares of the weights to the loss:
L2 regularization encourages small weights but does not force them to zero. It is differentiable and has a gradient that is proportional to the weight.
Mathematical properties: L2 regularization is the most common regularization technique in deep learning. It encourages the model to keep the weights small, which reduces overfitting by limiting the model's capacity. The L2 penalty is smooth and differentiable, making it easy to optimize with gradient descent.
Real-World Applications: Preventing overfitting (the most common regularization technique in deep learning, known as weight decay), ridge regression (used in linear models when features are correlated), and image classification (added to the loss function of CNNs to improve generalization).
5.3 Elastic Net Regularization
Elastic Net combines L1 and L2 regularization:
Elastic Net balances the sparsity of L1 with the smoothness of L2. It is particularly useful when there are correlated features.
Mathematical properties: Elastic Net combines the advantages of L1 and L2 regularization. It encourages sparsity like L1 and stability like L2. The two parameters λ₁ and λ₂ control the balance between the L1 and L2 penalties.
Real-World Applications: High-dimensional regression (when there are many correlated features), feature selection (combines L1 sparsity with L2 stability), and genomic data analysis (selecting a subset of genes while accounting for correlations).
5.4 Dropout as a Regularization Loss
Dropout is a regularization technique that randomly drops a fraction of the neurons during training. This prevents co-adaptation of neurons and encourages the network to learn redundant representations. Dropout can be interpreted as an ensemble of many sub-networks.
Mathematical properties: Dropout is a stochastic regularization technique that has become a standard component in deep learning architectures. During training, each neuron is dropped with probability p, and the remaining neurons are scaled to maintain the expected activation. During inference, all neurons are used. Dropout is effective at preventing overfitting and is used in many state-of-the-art models.
Real-World Applications: All modern deep learning architectures (ResNet, EfficientNet, Transformers) use dropout for regularization. Dropout is also used as a form of Bayesian approximation for uncertainty estimation.
Applications
- Feature selection (L1).
- Preventing overfitting (L2, Dropout).
- High-dimensional regression (Elastic Net).
Strengths and limitations
| Strengths | Limitations |
|---|---|
| L1 provides feature selection. | L1 is non-differentiable at zero. |
| L2 is smooth and stable. | L2 does not perform feature selection. |
| Elastic Net combines both. | Elastic Net has two hyperparameters. |
| Dropout is computationally efficient. | Dropout requires careful tuning of p. |
Table 7: Strengths and limitations of regularization losses. L1 provides feature selection by driving weights to zero, but it is non‑differentiable at zero. L2 is smooth and stable but does not perform feature selection. Elastic Net combines both but introduces two hyperparameters. Dropout is computationally efficient yet requires careful tuning of the drop probability p.
6. Boundary and Margin Losses
Boundary and margin losses are designed to create a decision boundary with a large margin between classes. These losses are used in support vector machines (SVMs) and other margin-based classifiers. The most common boundary loss is the Hinge Loss, which has already been discussed in the classification section. Other boundary losses include the Margin Ranking Loss and the Soft Margin Loss, which relax the hard margin requirement.
6.1 Hinge Loss (SVM)
The Hinge Loss is the standard loss for Support Vector Machines. It was defined in Section 2.4. It encourages a margin of at least 1 between the decision boundary and the data points.
Real-World Applications: Support Vector Machines (SVMs) for text classification, image classification, and bioinformatics. Hinge loss is also used in structured prediction tasks with SVMs.
6.2 Squared Hinge Loss
The Squared Hinge Loss was defined in Section 2.5. It squares the hinge loss, making it smooth and differentiable everywhere.
Real-World Applications: Differentiable SVMs, kernel methods with smooth optimization, and deep learning applications where smooth gradients are desirable.
6.3 Margin Ranking Loss
The Margin Ranking Loss is used for ranking tasks, where the goal is to learn a ranking of items. It is defined as:
where x is a query, y is a relevant item, z is an irrelevant item, and score(x, y) is the similarity score between x and y.
Mathematical properties: The margin ranking loss is a pairwise loss that is used in information retrieval and recommender systems. It is similar to the hinge loss but operates on pairs of items. The margin parameter controls the minimum separation between the scores of relevant and irrelevant items.
Real-World Applications: Information retrieval, recommender systems (often used in combination with collaborative filtering), and learning-to-rank tasks in search engines.
6.4 Logistic Loss (Soft Margin)
The Logistic Loss (also called the Soft Margin Loss) is a smooth approximation of the hinge loss. It is defined as:
The logistic loss is smooth and differentiable, and it is used in logistic regression and in some soft-margin SVM formulations. It is equivalent to binary cross-entropy.
Mathematical properties: The logistic loss is a convex, smooth approximation of the hinge loss. It is differentiable everywhere and has a well-defined gradient. The logistic loss is the foundation of logistic regression.
Real-World Applications: Logistic regression, soft-margin SVMs, and large-scale classification tasks where smooth optimization is beneficial.
Applications
- Support Vector Machines (Hinge Loss).
- Information retrieval (Margin Ranking Loss).
- Logistic regression (Logistic Loss).
Strengths and limitations
| Strengths | Limitations |
|---|---|
| Hinge loss maximizes margin. | Hinge loss is not differentiable. |
| Margin Ranking Loss is flexible. | Requires careful pair sampling. |
| Logistic loss is smooth and provides probabilities. | Logistic loss is sensitive to outliers. |
Table 8: Strengths and limitations of boundary losses. Hinge loss maximizes the classification margin but is not differentiable. Margin Ranking Loss is flexible for ranking tasks but requires careful pair sampling. Logistic loss (soft margin) is smooth and provides probabilities, yet remains sensitive to outliers like cross‑entropy.
7. Imbalanced Classification Losses
Imbalanced classification losses are designed to address the problem of class imbalance, where one class (the minority class) has significantly fewer samples than the other classes. Standard losses like cross-entropy tend to ignore the minority class, leading to poor performance. The most common imbalanced losses are Weighted Cross-Entropy, Focal Loss, and Class-Balanced Loss.
7.1 Weighted Cross-Entropy
Weighted Cross-Entropy assigns a higher weight to the minority class during training. The loss is:
where is the weight assigned to class . The weights are typically set inversely proportional to the class frequencies.
Mathematical properties: Weighted cross-entropy is a simple and effective way to handle class imbalance. By assigning higher weights to the minority class, the loss encourages the model to pay more attention to these samples.
Real-World Applications: Medical diagnosis (assigning higher weights to rare diseases), fraud detection (weighting fraudulent transactions more heavily), and anomaly detection (used in any task with imbalanced classes).
7.2 Focal Loss
Focal Loss was introduced in Section 2.6. It is designed to address class imbalance by down-weighting easy examples and focusing on hard examples.
Real-World Applications: RetinaNet object detection (focal loss was specifically designed for RetinaNet), imbalanced classification (medical diagnosis, fraud detection), and white blood cell detection (γ = 2.0 delivers the highest precision). RetinaNet with focal loss matches the speed of one-stage detectors while surpassing the accuracy of two-stage detectors (Lin et al., 2017).
7.3 Class-Balanced Loss
The Class-Balanced Loss is a general framework for re-weighting the loss based on the effective number of samples per class. The effective number is defined as:
where n is the number of samples in the class, and β is a hyperparameter that controls the rate at which the effective number saturates. The loss is then weighted by the inverse of the effective number.
Mathematical properties: The class-balanced loss is a more principled approach to handling class imbalance than simple weighting. It accounts for the diminishing returns of adding more samples to a class.
Real-World Applications: Imbalanced datasets (a principled approach to re-weighting), object detection (used with focal loss to further improve performance), and medical imaging (combined with other losses for rare disease detection).
7.4 Lovász Hinge Loss
The Lovász Hinge Loss is a loss function designed for semantic segmentation that directly optimizes the Intersection over Union (IoU) metric. It is defined using the Lovász extension of the hinge loss, which provides a smooth approximation of the IoU.
Mathematical properties: The Lovász hinge loss is a powerful loss for segmentation tasks where the goal is to maximize the IoU. Unlike cross-entropy, which treats each pixel independently, the Lovász hinge loss considers the entire segmentation mask and optimizes the IoU directly.
Real-World Applications: Semantic segmentation, medical image segmentation (used in state-of-the-art segmentation models), and autonomous driving (improving segmentation of road scenes).
Applications
- Medical diagnosis (Weighted Cross-Entropy).
- Object detection (Focal Loss).
- Semantic segmentation (Lovász Hinge Loss).
- Fraud detection (Class-Balanced Loss).
Strengths and limitations
| Strengths | Limitations |
|---|---|
| Effectively handles class imbalance. | Requires careful tuning of weights. |
| Focal loss is robust and effective. | Focal loss requires tuning γ. |
| Class-balanced loss is principled. | Class-balanced loss requires tuning β. |
| Lovász hinge optimizes IoU directly. | Lovász hinge is computationally expensive. |
Table 9: Strengths and limitations of imbalanced losses. Weighted cross‑entropy is simple but requires careful weight assignment. Focal loss is robust and effective yet demands tuning of γ. Class‑balanced loss is principled via effective numbers but introduces the β hyperparameter. Lovász hinge directly optimises IoU for segmentation, though it is computationally expensive.
8. Sequence and Structured Prediction Losses
Sequence and structured prediction losses are used when the output is a sequence or a structured object (e.g., a sentence, a parse tree, a segmentation mask). These losses must account for the dependencies between the output elements. The most common sequence losses are Connectionist Temporal Classification (CTC), Sequence Cross-Entropy, and CRF Loss.
8.1 Connectionist Temporal Classification (CTC)
Connectionist Temporal Classification (CTC) is a loss function used for sequence labeling tasks where the alignment between the input and output sequences is unknown. It is widely used in speech recognition and handwriting recognition. CTC defines a loss that marginalizes over all possible alignments:
where is an alignment path, is the function that removes repeated and blank tokens, and is the length of the input sequence.
Mathematical properties: CTC is a powerful loss for sequence labeling tasks where the alignment is unknown. It is used in speech recognition, handwriting recognition, and other sequence-to-sequence tasks. The CTC loss is differentiable and can be optimized with gradient descent.
Real-World Applications: Speech recognition (CTC is widely used in end-to-end Automatic Speech Recognition (ASR) systems), handwriting recognition (transcribing handwritten text from images), keyword spotting (CTC loss is used with triplet loss to learn word embeddings for keyword spotting), and multilingual ASR (CTC-DRO addresses language disparities in speech recognition across multiple languages).
8.2 Sequence Cross-Entropy (Teacher Forcing)
Sequence Cross-Entropy (also called Teacher Forcing) is the standard loss for sequence generation tasks. The model predicts the next token in the sequence given the previous tokens, and the loss is the cross-entropy between the predicted distribution and the true token:
During training, the model is fed the ground-truth previous tokens (teacher forcing).
Mathematical properties: Sequence cross-entropy is the standard loss for training autoregressive models. It is simple, differentiable, and effective.
Real-World Applications: Machine translation (the standard loss for training encoder-decoder models like Transformers), text generation (used in language models like GPT), and image captioning (training models to generate descriptions of images).
8.3 CRF Loss
The Conditional Random Field (CRF) Loss is used for structured prediction tasks where the output has a known structure, such as a sequence of labels in named entity recognition or a segmentation mask. The CRF loss models the conditional probability of the output given the input and encourages the output to respect the structural constraints.
Mathematical properties: The CRF loss is a structured prediction loss that captures the dependencies between output labels. It is used in tasks where the output has a known structure, such as part-of-speech tagging, named entity recognition, and semantic segmentation. The CRF loss is differentiable and can be optimized with gradient descent.
Real-World Applications: Named entity recognition (CRF loss is used in BERT-BiGRU-CRF and BiLSTM-CRF models to capture long-distance dependencies and enhance entity boundary recognition accuracy), part-of-speech tagging (capturing dependencies between tags in a sequence), and semantic segmentation (used with CRFs as a post-processing step or as a differentiable loss).
8.4 Connectionist Temporal Classification (CTC) vs. Cross-Entropy
The choice between CTC and cross-entropy depends on the task. CTC is preferred when the alignment between the input and output is unknown, as in speech recognition, where the length of the input spectrogram is much longer than the output text. Cross-entropy is preferred when the alignment is known, as in machine translation, where the input and output sequences have a known correspondence.
Applications
- Speech recognition (CTC).
- Machine translation (Sequence Cross-Entropy).
- Named entity recognition (CRF Loss).
- Handwriting recognition (CTC).
Strengths and limitations
| Strengths | Limitations |
|---|---|
| CTC handles unknown alignments. | CTC assumes monotonic alignment. |
| Sequence cross-entropy is simple and effective. | Teacher forcing can cause exposure bias. |
| CRF loss captures output dependencies. | CRF loss is computationally expensive. |
Table 10: Strengths and limitations of sequence losses. CTC handles unknown alignments (e.g., speech) but assumes monotonic alignment. Sequence cross‑entropy (teacher forcing) is simple and effective but can cause exposure bias during inference. CRF loss captures output dependencies but is computationally heavy for long sequences.
9. Generative Losses
Generative losses are used in generative models, where the goal is to learn the underlying distribution of the data and generate new samples. The most common generative losses are the GAN Loss (adversarial loss), the VAE Loss (variational autoencoder loss), and the Diffusion Loss (used in diffusion models). These losses are designed to encourage the generated samples to be indistinguishable from real data.
9.1 GAN Loss (Adversarial Loss)
The GAN Loss is the loss used in Generative Adversarial Networks. It consists of two losses: the discriminator loss and the generator loss. The discriminator tries to distinguish real from fake, while the generator tries to fool the discriminator.
Real-World Applications: Image generation (StyleGAN, BigGAN, and other models for generating realistic images), video generation (generating synthetic video sequences), and data augmentation (creating synthetic samples for training other models).
9.2 VAE Loss (Variational Autoencoder Loss)
The VAE Loss is the loss used in Variational Autoencoders. It consists of two terms: the reconstruction loss and the KL divergence.
Real-World Applications: Image generation (used in VAEs for generating new images like faces and digits), text generation (learning a latent space for sentences), and anomaly detection (reconstruction error is used to detect outliers).
9.3 Diffusion Loss
The Diffusion Loss is used in diffusion models, which learn to reverse a gradual noising process. The loss is the mean squared error between the predicted noise and the actual noise.
Real-World Applications: Image generation (DDPM, Stable Diffusion, DALL-E 2/3), audio generation (generating speech and music), and video generation (extending diffusion models to video synthesis).
Applications
- Image generation (GAN, VAE, Diffusion).
- Text generation (VAE).
- Video generation (GAN, Diffusion).
- Audio generation (Diffusion).
Strengths and limitations
| Strengths | Limitations |
|---|---|
| GAN produces sharp, high-quality samples. | GAN training can be unstable. |
| VAE provides a smooth latent space. | VAE can produce blurry samples. |
| Diffusion produces high-quality samples. | Diffusion is computationally expensive. |
Table 11: Strengths and limitations of generative losses. GAN loss produces sharp, high‑quality samples but training is notoriously unstable. VAE loss provides a smooth, structured latent space but often yields blurry reconstructions. Diffusion loss achieves state‑of‑the‑art quality but is computationally very expensive due to the iterative sampling process.
10. Multi-Task and Multi-Objective Losses
Multi-task losses are used when a model is trained to perform multiple tasks simultaneously. The loss is a weighted sum of the individual task losses.
10.1 Weighted Sum of Losses
The simplest approach is to use a weighted sum of the individual task losses. The weights can be set manually based on the importance of each task.
Real-World Applications: Multi-task classification, multi-task regression, and any scenario where multiple objectives must be balanced (e.g., autonomous driving where a model must handle detection, segmentation, and depth estimation simultaneously).
10.2 Uncertainty Weighting
Uncertainty Weighting is a technique for automatically learning the weights of the individual task losses based on the uncertainty (variance) of each task. The loss automatically balances the tasks based on their uncertainty.
Real-World Applications: Multi-task learning benchmarks (improving performance on multi-task learning tasks), multi-task neural networks (widely used in computer vision and NLP), and any domain where tasks have different scales and uncertainties.
10.3 Pareto Multi-Task Learning
Pareto Multi-Task Learning (MTL) is a framework that aims to find a set of Pareto-optimal solutions, where no task can be improved without degrading another task.
Real-World Applications: Multi-objective optimization, applications where tasks are in conflict (e.g., accuracy vs. efficiency, fairness vs. performance), and any domain where trade-offs must be explicitly managed.
Applications
- Multi-task classification (Weighted Sum).
- Multi-task regression (Uncertainty Weighting).
- Multi-objective optimization (Pareto MTL).
Strengths and limitations
| Strengths | Limitations |
|---|---|
| Simple and flexible. | Requires careful weight tuning. |
| Uncertainty weighting is automatic. | Uncertainty weighting requires variance estimation. |
| Pareto MTL finds optimal trade-offs. | Pareto MTL is computationally expensive. |
Table 12: Strengths and limitations of multi‑task losses. Weighted sum is simple and flexible but requires manual tuning of task weights. Uncertainty weighting automates balancing via variance estimation. Pareto MTL finds optimal trade‑offs but is computationally expensive and harder to implement in practice.
11. Advanced and Specialized Losses
Advanced and specialized losses have been developed for specific applications and challenges. These include ArcFace Loss for face recognition, Center Loss for fine-grained classification, Triplet Center Loss, and Angular Margin Loss.
11.1 ArcFace Loss
The ArcFace Loss is used for face recognition and adds an angular margin to the softmax loss.
Real-World Applications: Face recognition (ArcFace is a state-of-the-art loss for deep face recognition), cattle identification (CattleFaceNet integrates RetinaFace with ArcFace loss for livestock identification), masked face recognition (ArcFace has been modified to boost accuracy when dealing with masked faces), and large-scale face datasets (ArcFace is robust in handling large-scale datasets with diverse facial variations).
11.2 Center Loss
The Center Loss encourages the features of the same class to be close to their class center.
Real-World Applications: Face recognition (reduces intra-class variation), fine-grained classification (used in tasks where subtle differences between classes must be captured), and person re-identification (improving feature discriminability).
11.3 Triplet Center Loss
The Triplet Center Loss is a variant of the triplet loss that uses class centers instead of samples.
Real-World Applications: Person re-identification (provides more efficient training), and fine-grained classification (used when subtle differences between classes must be preserved).
11.4 Angular Margin Loss
Angular Margin Loss is a family of losses that add an angular margin to the softmax loss. Examples include CosFace and ArcFace.
Real-World Applications: Face recognition (improves discriminative power by enforcing an angular margin between classes) and fine-grained visual classification (used in species identification and product recognition).
Applications
- Face recognition (ArcFace, Center Loss).
- Fine-grained classification (Center Loss, Triplet Center Loss).
- Person re-identification (Triplet Center Loss).
Strengths and limitations
| Strengths | Limitations |
|---|---|
| ArcFace provides state-of-the-art performance. | Requires careful tuning. |
| Center loss reduces intra-class variation. | Center loss can be sensitive to outliers. |
| Angular margin losses are discriminative. | Angular margin losses are computationally expensive. |
Table 13: Strengths and limitations of advanced losses. ArcFace delivers state‑of‑the‑art face recognition performance but requires careful tuning of the angular margin. Center loss reduces intra‑class variation yet can be sensitive to outliers. Angular margin losses are highly discriminative but computationally heavier than standard softmax.
12. Contrastive and Self-Supervised Losses
Contrastive and self-supervised losses are used in unsupervised and self-supervised learning, where the goal is to learn representations from unlabeled data. These losses encourage the model to learn representations that are invariant to augmentations and discriminative between different instances.
12.1 InfoNCE Loss (SimCLR)
The InfoNCE Loss (used in SimCLR) is a contrastive loss that encourages the model to learn representations that are similar for positive pairs and dissimilar for negative pairs.
Real-World Applications: SimCLR self-supervised learning (pretraining encoders on unlabeled image datasets), contrastive learning (used in MoCo, CLIP, and other contrastive learning methods), and wearable time series (applied to high-dimensional health signals for downstream clinical classification) (Chen et al., 2020).
12.2 BYOL (Bootstrap Your Own Latent)
BYOL (Bootstrap Your Own Latent) is a self-supervised learning method that does not require negative samples.
Real-World Applications: Self-supervised learning (achieving state-of-the-art performance without requiring negative samples), image classification (pretraining on ImageNet), and object detection (pretrained BYOL encoders are used as backbones for detection models) (Grill et al., 2020).
12.3 MoCo (Momentum Contrast)
MoCo (Momentum Contrast) is a contrastive learning method that uses a momentum encoder and a queue of negative samples.
Real-World Applications: Contrastive learning (MoCo uses a momentum encoder and a queue of negative samples for efficient contrastive learning), image classification (pretraining on large unlabeled datasets), and transfer learning (learned representations transfer well to downstream tasks) (He et al., 2020).
Applications
- Self-supervised learning (SimCLR, BYOL, MoCo).
- Image representation learning (InfoNCE).
- Cross-modal retrieval (CLIP).
Strengths and limitations
| Strengths | Limitations |
|---|---|
| Learn representations without labels. | Require large batch sizes or queues. |
| BYOL does not require negative samples. | BYOL can be sensitive to architecture. |
| Scalable to large datasets. | Requires careful tuning. |
Table 14: Strengths and limitations of contrastive losses. They learn powerful representations without labels but often require large batch sizes or memory queues. BYOL avoids negative samples entirely, yet can be sensitive to architectural choices (e.g., predictor network, momentum coefficient). All methods scale to large datasets but demand extensive tuning of augmentations and hyperparameters.
13. Choosing the Right Cost Function and Distance Metric
The choice of a cost function or distance metric is one of the most important decisions in machine learning. It depends on the nature of the task, the type of data, and the desired properties of the model. This section provides a practical guide to selecting the right cost function and distance metric for different scenarios.
13.1 Decision Tree for Cost Function Selection
1. What is the task type?
- Regression (continuous targets): Use MSE for Gaussian noise, MAE for outliers, Huber for robustness, Log-Cosh for smooth robustness, or Quantile Loss for quantile prediction.
- Classification (discrete targets): Use Cross-Entropy for probabilistic models, Hinge Loss for SVMs, or Focal Loss for imbalanced datasets.
- Ranking (relative ordering): Use Contrastive Loss, Triplet Loss, or N-Pair Loss for metric learning.
- Sequence/Structured Prediction: Use CTC for unknown alignments, Sequence Cross-Entropy for known alignments, or CRF Loss for structured outputs.
- Generation: Use GAN Loss for adversarial generation, VAE Loss for variational generation, or Diffusion Loss for diffusion models.
- Self-Supervised Learning: Use InfoNCE (SimCLR), BYOL, or MoCo for contrastive learning.
2. Are there outliers or class imbalance?
- Outliers: Use MAE, Huber, or Log-Cosh for regression; Focal Loss for classification.
- Class Imbalance: Use Weighted Cross-Entropy, Focal Loss, or Class-Balanced Loss.
3. Is interpretability important?
- Yes: Use L1 regularization (Lasso) for feature selection, or simpler losses like MSE for regression.
- No: Use more complex losses like GAN Loss or VAE Loss.
4. Is the model deep or shallow?
- Deep: Use Cross-Entropy for classification, MSE for regression, and consider advanced losses like ArcFace or Center Loss for fine-grained tasks.
- Shallow: Use Hinge Loss for SVMs, or simple regression losses.
13.2 Decision Tree for Distance Metric Selection
1. What is the data type?
- Continuous: Use Euclidean (L2) for general purposes, Manhattan (L1) for robustness, Mahalanobis for correlated features.
- High-dimensional sparse: Use Cosine distance for text and embeddings.
- Binary: Use Hamming distance.
- Sets: Use Jaccard distance.
- Strings: Use Levenshtein distance (edit distance).
- Distributions: Use Earth Mover's (Wasserstein) distance or Jensen-Shannon divergence.
2. Are the features correlated?
- Yes: Use Mahalanobis distance.
- No: Use Euclidean or Manhattan.
3. Is magnitude important?
- Yes: Use Euclidean or Manhattan.
- No: Use Cosine distance.
13.3 Practical Examples
Example 1: House Price Prediction (Regression)
- Task: Predict house prices from features like size, location, number of bedrooms.
- Data: Contains some outliers (luxury properties).
- Choice: Huber Loss (robust to outliers, smooth gradient).
- Distance Metric: Euclidean (for feature similarity).
Example 2: Image Classification (Classification)
- Task: Classify images into 1000 object categories.
- Data: Balanced dataset (ImageNet).
- Choice: Categorical Cross-Entropy (standard for classification).
- Distance Metric: Cosine (for feature embeddings).
Example 3: Face Recognition (Metric Learning)
- Task: Learn embeddings for face recognition.
- Data: Large-scale face dataset.
- Choice: ArcFace Loss (state-of-the-art for face recognition).
- Distance Metric: Cosine (for embedding similarity).
Example 4: Medical Diagnosis (Imbalanced Classification)
- Task: Detect rare diseases from medical images.
- Data: Highly imbalanced (few positive samples).
- Choice: Focal Loss (focuses on hard examples).
- Distance Metric: Mahalanobis (for multivariate features).
13.4 Evaluation and Validation
The choice of a cost function or distance metric should be validated using appropriate metrics. For regression, use RMSE, MAE, or R². For classification, use accuracy, precision, recall, F1-score, or AUC-ROC. For metric learning, use the Recall@K or mAP. For distance metrics, evaluate the quality of the similarity measure using tasks like clustering purity or retrieval accuracy.
14. Real-World Applications: Comprehensive Reference Guide
This section provides a consolidated reference of real-world applications for each cost function and distance metric covered in this article. The table below summarizes the primary use cases, specific models or architectures, and key references for each function. This serves as a practical guide for practitioners selecting the right tool for their specific machine learning task.
| Function / Metric | Primary Applications | Key Models / Architectures | References |
|---|---|---|---|
| L1 Loss (Manhattan) | Bounding box regression in YOLO, robust regression, pathfinding, MAE loss | YOLO, Balanced L1 Loss | Redmon & Farhadi, 2018; Fan et al., 2019 |
| L2 Loss (Euclidean) | Linear regression, K-means, KNN, MSE loss, wireless NMSE | Linear regression models, K-means clustering | Wang et al., 2020; Gauss, 1821 |
| Huber Loss | Parameter estimation in nonlinear systems, robust regression, Boston Housing | Huber loss-guided neural networks, Keras models | Chen et al., 2019; Huber, 1964 |
| MAE | Radiation therapy dose prediction, robust forecasting | DeepDoseNet, TensorFlow/Keras regression | Fan et al., 2019 |
| Cross-Entropy | Image classification, medical diagnosis, object detection | ResNet, EfficientNet, Vision Transformers, Chest X-ray classifiers, YOLO | Krizhevsky et al., 2012; Deng et al., 2009 |
| Focal Loss | RetinaNet object detection, imbalanced classification, WBC detection | RetinaNet, imbalanced classifiers | Lin et al., 2017 |
| Triplet Loss | Face recognition, person re-identification, image retrieval | FaceNet, Re-ID networks | Schroff et al., 2015 |
| ArcFace Loss | Face recognition, cattle identification, masked face recognition | ArcFace, CattleFaceNet | Deng et al., 2019 |
| Contrastive Loss | Self-supervised learning (SimCLR), image classification | SimCLR, YOLOv8 (SimCLR-pretrained) | Chen et al., 2020 |
| CTC Loss | Speech recognition, handwriting recognition, keyword spotting | End-to-end ASR, Whisper, Deep Speech | Graves et al., 2006 |
| CRF Loss | Named entity recognition, sequence labeling, POS tagging | BERT-BiGRU-CRF, BiLSTM-CRF | Lafferty et al., 2001 |
| Wasserstein Loss | WGAN, IIoT anomaly detection, domain adaptation | WGAN, WGAN-based anomaly detectors | Arjovsky et al., 2017; Li et al., 2021 |
| KL Divergence | VAEs, knowledge distillation, transfer learning, drift detection | VAEs, knowledge distillation frameworks | Kingma & Welling, 2014; Hinton et al., 2015 |
| Levenshtein Distance | Spell checking, autocorrect, legal term correction, duplicate address detection | pyspellchecker, Ispell | Barr, 2020; Levenshtein, 1966 |
| Cosine Distance | Movie recommendation, text retrieval, document similarity, embedding comparison | KNN-based movie recommenders, CLIP, BERT embeddings | Sarwar et al., 2001 |
| L1 Regularization (Lasso) | Feature selection in genomics, software defect prediction, sparse signal recovery | LASSO, sparse linear models | Tibshirani, 1996 |
| Center Loss | Face recognition, fine-grained classification, person re-identification | Center loss networks | Wen et al., 2016 |
| BYOL Loss | Self-supervised learning, image classification, object detection | BYOL encoders | Grill et al., 2020 |
| MoCo Loss | Contrastive learning, image classification, transfer learning | MoCo, MoCo v2 | He et al., 2020 |
| Mahalanobis Distance | Anomaly detection, quality control, metric learning, outlier detection | Mahalanobis-based detectors, Taguchi methods | Mahalanobis, 1936; Taguchi & Jugulum, 2002 |
| Hamming Distance | Error correction, binary classification, image hashing | Hamming codes, perceptual hashing algorithms | Hamming, 1950 |
| Jaccard Distance | Document similarity, recommendation systems, image segmentation | Set-based similarity measures, collaborative filtering | Jaccard, 1901 |
Table 2: Application reference guide. For each function, the table lists primary applications, key models or architectures that use it, and seminal references. This guide serves as a practical resource when selecting the appropriate cost function or distance metric. Notable examples include ArcFace for face recognition, Focal Loss for object detection with RetinaNet, CTC for speech recognition, and Contrastive Loss (InfoNCE) for self‑supervised learning with SimCLR.
Table 2 provides a comprehensive reference for real-world applications of each cost function and distance metric covered in this article. For each function, the table lists the primary applications, key models or architectures that use it, and relevant references. This table serves as a practical guide for practitioners when selecting the appropriate cost function or distance metric for their specific task. The references provided are the seminal works that introduced or popularized the use of each function in their respective domains.
14.2 Application Case Studies
Case Study 1: Face Recognition with ArcFace ArcFace has become the standard loss for deep face recognition, adding an angular margin to the softmax loss to learn discriminative features. It has been adopted in large-scale face recognition systems and has been extended to cattle identification (CattleFaceNet) and masked face recognition, demonstrating its versatility and robustness (Deng et al., 2019).
Case Study 2: Object Detection with Focal Loss Focal Loss was introduced specifically for RetinaNet to address the extreme class imbalance in dense object detection. By down-weighting easy examples and focusing on hard examples, RetinaNet with Focal Loss achieves the speed of one-stage detectors while surpassing the accuracy of two-stage detectors, making it a widely adopted solution in production systems (Lin et al., 2017).
Case Study 3: Self-Supervised Learning with SimCLR SimCLR uses the InfoNCE contrastive loss to pretrain encoders on unlabeled image datasets, achieving strong performance on downstream tasks. This approach has been extended to YOLOv8, where SimCLR-pretrained models achieve higher mAP than their supervised counterparts, demonstrating the power of contrastive learning in practical applications (Chen et al., 2020).
Case Study 4: Speech Recognition with CTC CTC loss enables end-to-end speech recognition without requiring frame-level alignment. It has been used in Deep Speech, Whisper, and many commercial speech recognition systems. CTC-DRO extends the approach to address language disparities in multilingual speech recognition, showing the ongoing development of this fundamental loss (Graves et al., 2006).
Key takeaways
- Distance metrics are the foundation of similarity measurement, used in clustering, retrieval, and as building blocks for cost functions.
- Cost functions are the core of machine learning optimization, defining what the model learns.
- Regression losses (MSE, MAE, Huber) are used for continuous targets, with trade-offs between smoothness, robustness, and outlier sensitivity.
- Classification losses (Cross-Entropy, Hinge, Focal) are used for discrete targets, with different properties for probability estimation, margin maximization, and imbalance handling.
- Probabilistic losses (KL Divergence, JSD, Wasserstein) are used for distributional modeling and generative tasks.
- Ranking losses (Contrastive, Triplet, N-Pair) are used for metric learning and information retrieval.
- Regularization losses (L1, L2, Elastic Net) are used to prevent overfitting and encourage desirable properties.
- Imbalanced losses (Weighted Cross-Entropy, Focal, Class-Balanced) address the problem of class imbalance.
- Sequence losses (CTC, Sequence Cross-Entropy, CRF) are used for sequence and structured prediction.
- Generative losses (GAN, VAE, Diffusion) are used for generative modeling.
- Multi-task losses balance multiple objectives, often using uncertainty weighting or Pareto optimization.
- Advanced losses (ArcFace, Center Loss) provide state-of-the-art performance for specialized tasks.
- Contrastive losses (InfoNCE, BYOL, MoCo) are used for self-supervised representation learning.
- The choice of cost function and distance metric depends on the task, data, and desired properties of the model.
Resources
The sources below are seminal papers and textbooks that define the field of distance metrics and cost functions in machine learning and deep learning.
- [1] Euclidean Distance — Euclid (c. 300 BC). Elements. doi.org
- [2] On the Generalized Distance in Statistics — Mahalanobis, P. C. (1936). Proceedings of the National Institute of Sciences of India. doi.org
- [3] Binary Codes Capable of Correcting Deletions, Insertions and Reversals — Levenshtein, V. I. (1966). Soviet Physics Doklady. doi.org
- [4] Mean Squared Error — Gauss, C. F. (1821). Theoria combinationis observationum erroribus minimis obnoxiae. doi.org
- [5] Robust Estimation of a Location Parameter — Huber, P. J. (1964). Annals of Mathematical Statistics. doi.org
- [6] Cross-Entropy — Shannon, C. E. (1948). A Mathematical Theory of Communication. Bell System Technical Journal. doi.org
- [7] Kullback-Leibler Divergence — Kullback, S. & Leibler, R. A. (1951). On Information and Sufficiency. Annals of Mathematical Statistics. doi.org
- [8] Generative Adversarial Nets — Goodfellow, I. et al. (2014). NeurIPS. arxiv.org
- [9] Auto-Encoding Variational Bayes — Kingma, D. P. & Welling, M. (2014). ICLR. arxiv.org
- [10] Connectionist Temporal Classification — Graves, A. et al. (2006). ICML. doi.org
- [11] Focal Loss for Dense Object Detection — Lin, T. Y. et al. (2017). ICCV. arxiv.org
- [12] FaceNet: A Unified Embedding for Face Recognition and Clustering — Schroff, F. et al. (2015). CVPR. arxiv.org
- [13] ArcFace: Additive Angular Margin Loss for Deep Face Recognition — Deng, J. et al. (2019). CVPR. arxiv.org
- [14] A Simple Framework for Contrastive Learning of Visual Representations (SimCLR) — Chen, T. et al. (2020). ICML. arxiv.org
- [15] Bootstrap Your Own Latent (BYOL) — Grill, J. B. et al. (2020). NeurIPS. arxiv.org
- [16] Denoising Diffusion Probabilistic Models (DDPM) — Ho, J. et al. (2020). NeurIPS. arxiv.org
- [17] Regression Shrinkage and Selection via the Lasso — Tibshirani, R. (1996). Journal of the Royal Statistical Society. doi.org
- [18] A Discriminative Feature Learning Approach for Deep Face Recognition (Center Loss) — Wen et al. (2016). ECCV. doi.org
- [19] Wasserstein GAN — Arjovsky, M. et al. (2017). ICML. arxiv.org
- [20] Distilling the Knowledge in a Neural Network (Knowledge Distillation) — Hinton, G. et al. (2015). NeurIPS. arxiv.org