Negative Log-Likelihood as a Loss Function
TL;DR: - For categorical outcomes (e.g., classification), the negative log-likelihood corresponds to the cross-entropy loss. - For continuous outcomes (e.g., regression), assuming a Gaussian distribution, the negative log-likelihood corresponds to the Mean Squared Error (MSE) loss.
Notation
| Symbol | Type | Explanation |
|---|---|---|
| Function | Likelihood of data |
|
| Observed data or input | ||
| Parameters of the model. In VQ-VAE, |
||
| Latent representation in the model, serving as the effective model parameters |
||
| Function | Decoder function in visually generative models such as VQ-VAE. |
|
| Reconstructed image or output, equal to |
||
| Assumed distribution of |
||
| Actual label in classification | ||
| Model's predicted probability for the true class |
||
| Number of classes in multi-class classification | ||
| One-hot encoded true label for class |
||
| Function | Squared L2 norm. For a vector |
Likelihood Function
The likelihood function
Negative Log-Likelihood and MSE
If the conditional distribution of
MSE is simply the squared
Negative Log-Likelihood and Cross-Entropy
For multi-class classification, the log-likelihood for a single observation is:
Here,
The cross-entropy loss for a single observation is
Thus, the cross-entropy loss is exactly the negative log-likelihood of the true class: