Glossary

What is Cross-entropy?

In Turkish: Çapraz entropi · Topic: Math foundations

The average cost of encoding events from the true distribution using another distribution, such as a model's. In machine learning, it is a common loss function that measures how far a model's predicted probabilities are from the true labels.

How does it work?

For each training example the true class is known, while the model assigns probabilities to the classes. Cross-entropy takes the negative logarithm of the probability the model gave to the true class. If the model gives the correct class a high probability, the penalty is small; if it gives a low probability, the penalty grows quickly, so confident but wrong predictions are punished heavily. The average over all examples is minimized during training with gradient descent. This pushes the model's probabilities toward the true distribution.

Why does it matter?

It is among the most common loss functions for training classifiers and large language models. In classification it equals the negative log-likelihood, which ties it to the principle of maximum likelihood. Perplexity, a measure often mentioned for language models, is derived from cross-entropy.

Example

If an image classifier gives 90 percent probability to the cat in a photo, the cross-entropy loss is low; if it gives 1 percent, the loss is much higher.

FAQ

What is the difference between cross-entropy and entropy?

Entropy is the uncertainty of a distribution on its own. Cross-entropy is the cost of encoding events from the true distribution using a different one, and it is always at least as large as the entropy. The gap between them is the KL divergence.

Is cross-entropy used for regression too?

Usually not. Because it compares probability distributions, it is common in classification and language modeling. For predicting numerical values, measures such as mean squared error are more often preferred.

All terms