Cross-entropy

Cross-entropy loss equation: H(p, q) = -Σ(p(x) * log(q(x)))

Image: Jahobr, CC0, via Wikimedia Commons

Cross-entropy

Cross-entropy loss equation: H(p, q) = -Σ(p(x) * log(q(x)))

Cross-entropy loss is a measure used in machine learning to quantify the difference between two probability distributions. It is particularly useful for comparing the predicted probabilities (q) with the actual probabilities (p) of events.

Cross-entropy loss helps in optimizing machine learning models by providing a clear metric for how well the model's predictions align with the true data distribution. By minimizing this loss, models can improve their accuracy and performance over time.

The equation for cross-entropy loss is H(p, q) = -Σ(p(x) * log(q(x))), where p(x) represents the actual probability distribution, q(x) represents the predicted probability distribution, and the summation Σ extends over all possible events x.

Example

Suppose we have a binary classification problem with two classes: A and B. Let p(A) = 0.7 and p(B) = 0.3 be the true probabilities. If our model predicts q(A) = 0.6 and q(B) = 0.4, the cross-entropy loss would be calculated as follows: H(p, q) = -[ (0.7 * log(0.6)) + (0.3 * log(0.4)) ]

Understanding and applying the cross-entropy loss equation is crucial for improving the performance of machine learning models, as it directly influences how well the model's predictions match the actual data.

Related concepts

One email a day: 5 concepts + the 5 stories that matter →

Swipe through 100 ML concepts daily

Open TickerNews