Gradient

Courses

∇\nabla∇The maths behind AI0/72
π\piπMaths0/84
⋆\star⋆AI for everyone0/10
Γ\GammaΓGame theory0/49
py\texttt{py}pyPython for AI0/15
y^\hat{y}y^​Build your own AI0/15
All courses

Tuition

My tuitionOlympiad trackCompetitions

Practice

ProjectsAsk a questionTrain on a GPUExplorationsMaths StoriesUnsolved problemsPlaygroundScience labsMock testsOlympiad

Reference

GlossaryBlogDiscoveries
Glossary › Entropy

What is entropy?

The average surprise of a distribution, −∑plog⁡2p-\sum p \log_2 p−∑plog2​p in bits. It is zero when one outcome is certain and largest when all are equally likely.

Where it is taught

Entropy and information. How much uncertainty a distribution holds, measured in bits. It explains where the name cross-entropy comes from and what a loss value is really counting.

What the lesson leaves you with

  • An outcome with probability ppp carries −log⁡2p-\log_2 p−log2​p bits.
  • Entropy is the average surprise of a distribution.
  • Cross-entropy is the surprise when you believe qqq and the truth is ppp. It is lowest when they match.
Open the lesson

Questions

What is entropy?
The average surprise of a distribution, -sum p log_2 p in bits. It is zero when one outcome is certain and largest when all are equally likely.
Where is entropy used in AI?
How much uncertainty a distribution holds, measured in bits. It explains where the name cross-entropy comes from and what a loss value is really counting.
What is the key idea to remember about entropy?
An outcome with probability <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>p</mi></mrow><annotation encoding="application/x-tex">p</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="katex-base"><span class="katex-strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">p</span></span></span></span> carries <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo>−</mo><msub><mrow><mi>log</mi><mo>⁡</mo></mrow><mn>2</mn></msub><mi>p</mi></mrow><annotation encoding="application/x-tex">-log_2 p</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="katex-base"><span class="katex-strut" style="height:0.9386em;vertical-align:-0.2441em;"></span><span class="mord">−</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mop"><span class="mop">lo<span style="margin-right:0.0139em;">g</span></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.207em;"><span style="top:-2.4559em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="katex-sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.2441em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal">p</span></span></span></span> bits.
Where can I learn entropy step by step?
In the lesson “Entropy and information” in Gradient’s course on the maths behind AI, with interactive diagrams and questions.

Related terms

  • Bayes' rule
  • Cross-entropy
  • Logit
  • Perplexity
  • Softmax
  • Temperature