Machine Learning

Cross-Entropy

A loss function commonly used in classification tasks that measures the difference between the predicted probability distribution and the actual distribution. Lower cross-entropy means better predictions.

Why It Matters

Cross-entropy is the standard loss function for training classification models and language models. It directly optimizes the model to make more confident correct predictions.

Example

If the true class is 'cat' (probability 1.0 for cat, 0 for others) and the model predicts 0.7 for cat, cross-entropy penalizes the model for not being confident enough.

Think of it like...

Like a weather forecaster being scored — if they say 70% chance of rain and it rains, they did okay, but they would score better if they had said 95%.

Related Terms