liveBook · Manning

Information gain

As explained in Grokking AI Algorithms, Second Edition

Information gain is the reduction in dataset uncertainty produced by applying a particular split or question.

Information gain measures how much a question reduces uncertainty in a dataset. Decision trees compare candidate feature questions and prefer the split producing the greatest reduction. section 8.17

Calculate it by comparing uncertainty before and after a split:

  • Split the examples using a question, such as whether Price is at least 3,914. section 8.17
  • Measure the Gini index for the left and right groups, weighting each group's uncertainty by its size. section 8.17
  • Select the question with the highest gain as the next decision node. section 8.17

A useful split

For the question “Is Price >= 3,914?”, calculate the gain for its two resulting groups. A split that leaves one side containing only Perfect diamonds has reduced uncertainty substantially, making the question a strong candidate. section 8.17

How Grokking AI Algorithms, Second Edition covers it

How deep it goes
Explains the weighted split calculation and implements exhaustive feature-value search, without developing formal proofs.
Examples
Uses a diamond-price threshold and a split yielding Perfect diamonds on one side.
What it assumes
Assumes familiarity with datasets and features while defining uncertainty, Gini index, and entropy during the procedure.
What you can do after
Build a Python split scorer that selects the highest-gain question for a decision-tree node.
How it connects
Connects decision trees with uncertainty, Gini index, entropy, decision nodes, and data splitting.

Also explained in

Compare how 4 books explain information gain →

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.