liveBook · Manning

Entropy

As explained in Grokking AI Algorithms, Second Edition

Entropy is a measure of disorder or uncertainty in a probability distribution or dataset.

Entropy measures disorder or uncertainty in a probability distribution or dataset. In a decision tree, uncertainty describes how mixed the labels are before and after a question splits the examples. section 8.17

Decision-tree training uses uncertainty to choose useful questions:

  • Count how many examples belong to each class. section 8.17
  • Try feature-value questions such as “Is Carat >= 0.5?” and split examples into true and false groups. section 8.17
  • Prefer the question that produces the greatest information gain, meaning the largest reduction in uncertainty. section 8.17

Diamond classification

A tree can test Carat and Price values to separate Okay and Perfect diamonds. The resulting branches continue splitting until a leaf contains examples from one class or no further gain is available. section 8.17

Figure 8.20 Example of uncertainty
08_20

Use the uncertainty illustration to visualize why mixed class groups are less certain than single-class groups. section 8.17

How Grokking AI Algorithms, Second Edition covers it

How deep it goes
Defines uncertainty and traces split selection, but implements the calculation with Gini terminology rather than a standalone entropy formula.
Examples
Uses diamond quality labels, Carat and Price questions, class-count maps, tree nodes, and Python listings.
What you can do after
Build it from scratch by counting labels, evaluating candidate splits, calculating uncertainty reduction, and constructing tree nodes.
How it connects
Links entropy with decision trees, information gain, Gini index, class labels, and dataset partitioning.

Also explained in

Compare how 13 books explain entropy →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking AI Algorithms, Second Edition. The section links point to the parts of the book it draws on.