liveBook · Manning

Binary tree

As explained in Grokking Machine Learning

A tree data structure in which each node has at most two child branches.

A binary tree is made of nodes connected by branches, with at most two branches leaving each node. A decision tree uses this structure for yes-or-no questions: the root is the first question, decision nodes ask further questions, and leaves have no branches. section 9.0

Tree depth is the number of levels below the root, or the number of branches on the longest path from root to leaf. A decision stump has one decision node and two leaves, so its depth is one. section 9.0

Figure 9.1 A decision tree used to decide whether we want to wear a jacket or not on a given day. We make the decision by traversing the tree down and taking the branch corresponding to each correct answer.

Follow the branches to see how rain and temperature questions lead to a jacket decision. section 9.0

How Grokking Machine Learning covers it

How deep it goes
Defines roots, decision nodes, leaves, branches, and tree depth.
Examples
Uses rain and temperature questions to decide whether to wear a jacket.
What you can do after
Apply branch traversal to follow yes-or-no questions toward a decision.
How it connects
Connects binary trees with decision trees, decision nodes, leaves, and branches.

Also explained in

Compare how 4 books explain binary tree →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Machine Learning. The section links point to the parts of the book it draws on.