liveBook · Manning

Uncertainty

As explained in Grokking AI Algorithms, Second Edition

Uncertainty is the degree of unpredictability or class mixture in a dataset.

Uncertainty describes how unpredictable or mixed the classes in a dataset are. A group containing one class is more settled than a group mixing several classes. Decision-tree training uses this measure to choose questions that make the resulting groups clearer. section 8.17

Choosing a clearer split

Suppose a diamond dataset labels examples as Okay or Perfect. The tree tests questions such as “Is Carat >= 0.5?” or “Is Price >= 3,045?” It counts labels, measures the current uncertainty, splits the examples, measures the uncertainty remaining in both groups, and selects the question with the greatest information gain. section 8.17

The implementation makes the calculation concrete:

  • Counts how many examples belong to each label. section 8.17
  • Uses class probabilities to calculate Gini uncertainty. section 8.17
  • Subtracts weighted post-split uncertainty from the current value to obtain information gain. section 8.17
Figure 8.20 Example of uncertainty
08_20

Use the uncertainty illustration to reinforce the contrast between mixed and settled class groupings. section 8.17

How Grokking AI Algorithms, Second Edition covers it

How deep it goes
Calculates uncertainty from label counts and probabilities, then uses weighted reductions to compare candidate splits.
Examples
Uses Okay and Perfect diamond labels, Carat and Price thresholds, and Python functions for counting, Gini, and information gain.
What it assumes
Assumes labeled examples, classes, and feature values while teaching uncertainty calculations through a concrete decision-tree workflow.
What you can do after
Evaluate candidate decision-tree questions by calculating class impurity and information gain.
How it connects
Connects class labels, Gini index, entropy, information gain, decision nodes, and data splitting.

Also explained in

Compare how 10 books explain uncertainty →

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.