MACHINE LEARNING • LESSON 9

Nodes and Branches

A Decision Tree is made up of different parts called nodes and branches. Understanding these parts makes it much easier to understand how a Decision Tree works.

THE SIMPLEST IDEA

Nodes ask questions. Branches connect the decisions.

A tree starts at a root node, moves through branches and decision nodes, and eventually reaches a leaf node containing the final prediction.

01

The Four Main Parts

A simple Decision Tree can be understood using four important terms.

01 Root Node

The starting point of the tree.

02 Decision Node

A question that divides the data.

03 Branch

The path taken after a decision.

04 Leaf Node

The final prediction or result.

02

What Is the Root Node?

The root node is the first point in a Decision Tree.

It contains the first decision that the model uses to split the data.

ROOT NODE Is Study Hours > 3?

Every prediction starts from this point.

Think of the root node as the first question in a decision-making process.
03

What Is a Decision Node?

A decision node is a point where the tree asks a question and splits the data.

For example:

DECISION NODE Is Attendance > 80%?

The answer creates different paths.

YES Follow the Yes branch
NO Follow the No branch

The root node is also a decision node when it contains the first question. The term root describes its position at the top of the tree.

04

What Is a Branch?

A branch is the path connecting one decision to the next part of the tree.

For a simple Yes/No question, there are usually two possible branches.

DECISION Study Hours > 3?
NO BRANCH 3 hours or less
YES BRANCH More than 3 hours

The branch tells the model which direction to follow based on the input value.

05

What Is a Leaf Node?

A leaf node is the endpoint of a path in the Decision Tree.

It contains the final prediction.

LEAF NODE PASS
LEAF NODE FAIL

Once the model reaches a leaf node, it stops following that path and returns the prediction.

A leaf node does not ask another question. It gives the final answer.
06

See All the Parts Together

Let's put the four concepts into one simple tree.

ROOT NODE Study Hours > 3?
NO BRANCH
LEAF NODE FAIL
YES BRANCH
DECISION NODE Attendance > 80%?
YES PASS
NO FAIL
07

Follow One Complete Path

Suppose a student has:

STUDY HOURS 5
ATTENDANCE 90%

Now follow the tree step by step.

STEP 1 Root Node

Study Hours > 3?

STEP 2 Yes Branch

5 > 3, so follow Yes.

STEP 3 Decision Node

Attendance > 80%?

STEP 4 Leaf Node

90 > 80 → Pass.

08

Another Example

Consider a simple model that predicts whether someone should play outside.

ROOT NODE Is it raining?
YES BRANCH
LEAF NODE Don't Play
NO BRANCH
DECISION NODE Is it too hot?
YES Maybe
NO Play

Notice how the first question is the root node. The paths leaving it are branches. The second question is another decision node, and the final answers are leaf nodes.

09

The Difference Between a Node and a Branch

These two terms are easy to mix up, so keep the distinction simple.

NODE A point in the tree

Usually contains a question or a final prediction.

BRANCH A path between decisions

Determines which direction the input follows.

Node = a point. Branch = a path.
10

Why These Parts Matter

When you understand these four terms, a Decision Tree diagram becomes much easier to read.

ROOT Where the tree starts
DECISION Where the tree asks a question
BRANCH The path taken
LEAF Where the prediction ends
REMEMBER THIS

A Decision Tree is a collection of nodes connected by branches.

The tree starts at the root, makes decisions through nodes, follows branches, and ends at a leaf containing the final prediction.

Root Node Branch Decision Node Branch Leaf Node
QUICK CHECK

Check Your Understanding

What is the root node? The starting point of the Decision Tree.
What is a decision node? A node that contains a question used to split the data.
What is a branch? The path followed after a decision.
What is a leaf node? The endpoint of a path where the final prediction is made.
NEXT TOPIC

Splitting Data

Next, we will learn how a Decision Tree separates data into smaller groups and why choosing a good split is important.