liveBook · Manning

CART

As explained in Grokking AI Algorithms, Second Edition

CART is a decision-tree algorithm that constructs binary trees for classification and regression.

CART (Classification and Regression Tree) learns a binary decision tree by asking feature-based questions that separate examples into their categories. For diamond data, it might ask whether Carat is at least 0.5 or whether Price exceeds a threshold. section 8.17

A practical CART training loop works like this:

  • Represent each decision as a question, then split examples into true and false groups. section 8.17
  • Measure impurity with the Gini index, which reflects how mixed the labels are. section 8.17
  • Test feature values, choose the split with the greatest information gain, and repeat recursively. section 8.17
  • Stop when a split produces no gain and store the remaining label counts in a leaf node. section 8.17
Figure 8.19 A basic flow for building a decision tree
08_19

Use the flow diagram to follow CART from candidate questions through data splits to a trained tree. section 8.17

How Grokking AI Algorithms, Second Edition covers it

How deep it goes
Explains data structures, Gini uncertainty, information gain, candidate splits, recursion, and stopping, while leaving formal theory aside.
Examples
Uses Okay and Perfect diamond labels, Carat and Price questions, tree diagrams, and Python implementations.
What it assumes
Assumes familiarity with labeled examples and basic tree-like data structures while developing the algorithm incrementally.
What you can do after
Builds a basic decision tree from scratch using questions, Gini calculations, information gain, nodes, and recursion.
How it connects
Connects decision trees with entropy, Gini index, information gain, classification, and overfitting.

Also explained in

Compare how 2 books explain CART →

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.