{
  "id": 3381690,
  "title": "Entropy and Cross-Entropy, Explained",
  "url": "https://urgent.news/2026/08/25/entropy-and-cross-entropy-explained",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-25T23:43:19.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/aahanchauhan/entropy-and-cross-entropy-explained-f3m"
  },
  "original_language": "en",
  "account": "Entropy and Cross-Entropy, Explained\n\nEntropy, derived from information theory, gauges the level of surprise associated with the outcome of a random event. Consider two coins, Coin A, fair with equal chances of heads and tails, and Coin B, rigged with a 99% chance of heads. Flipping Coin B would rarely surprise you due to its predictable nature, while Coin A would leave you in disbelief each time. Entropy quantifies this uncertainty, with a fair coin exhibiting high entropy (maximum uncertainty) and a rigged coin displaying low entropy (predictable outcomes). The formula for entropy is H(P) = -Σ p(x)log(p(x)), where p(x) represents the probability of an event. Rare events, with small p(x), generate higher surprise scores, while common events, with larger p(x), result in lower surprise scores. Entropy, essentially, is the average surprise experienced when sampling from a distribution.\n\nCross-entropy builds upon the concept of entropy, but without assuming prior knowledge of the true distribution of outcomes. In machine learning, we often lack this knowledge and instead aim to predict the distribution. The cross-entropy formula is H(P,Q) = -Σ p(x)log(q(x)), where P is the true distribution (the actual label of an image) and Q is the predicted distribution (the model's guess). The key difference from entropy lies in the log term, which now uses the predicted probability q(x) instead of the true probability p(x). The intuition behind cross-entropy is that if the predicted distribution Q closely matches the true distribution P, the cross-entropy will be low. Conversely, if the model confidently predicts incorrectly, the cross-entropy value will skyrocket. This is precisely the desired behavior for a loss function: confident and correct predictions lead to low loss, while confident and incorrect predictions result in high loss. Uncertain predictions yield moderate losses.",
  "summary": "If you've spent any time around machine learning the familiarizing yourself with the concept, you have seen the term \"entropy\" and \"cross entropy\" show up everywhere. These two distinct terms often show up in topics regarding: classification models, neural networks, and understanding language models. But if you are like me a few weeks ago, you would not be able to write down the formulas without…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}