2.3.1 · D1Tree-Based & Instance Methods

Foundations — Decision tree structure and terminology

2,502 words11 min readBack to topic

This page assumes you know how to count and read a graph with an and axis. Nothing more. We build every symbol the parent note throws at you, in an order where each piece stands on the one before it.


0. The raw ingredients: samples, features, targets

Before any tree exists, we have a table of data. Picture a spreadsheet.

Figure — Decision tree structure and terminology

How to read this figure: each dot is one sample. Its horizontal position is Feature 1 (Income) and its vertical position is Feature 2 (Age) — the two axes. Its colour is the target: magenta dots are class A, violet dots are class B. Notice the two colours already sit in different corners of the grid — that separation is exactly what a tree will try to fence off with straight cuts. The orange arrow points at one single dot to remind you: one dot = one row of the spreadsheet = one sample.

Why the topic needs this: a decision tree's entire job is to look at where the dots sit (features) and predict their colour or number (target). No dots, no tree.


1. Subscripts and indexing: ,

The parent note writes things like and . These little lowered letters are just labels that say "which one".

We meet one more symbol, , in section 3 — but only after we have defined the box that a dot can belong to. We build the box first.

Why the topic needs this: the leaf-prediction formulas point at individual dots () and individual features (); without subscripts you can't say which one.


2. The test : a question that draws a line

This is the heart of the whole topic.

Here is the visual that makes "axis-aligned" click:

Figure — Decision tree structure and terminology

Why the topic needs this: every internal node in the parent note is one of these tests. Stack a few and you carve the grid into boxes (next section).


3. Regions, boxes, and membership: , hyper-rectangles, and

Now that a box exists, the membership symbol has something to point into:

Figure — Decision tree structure and terminology

4. The tools inside the leaf formulas

The parent derives two leaf predictions. Let's arm every symbol first. Throughout, every sum runs over only the dots inside this leaf's box, never all samples.

4a. — "the predicted answer"

4b. — "add them all up"

4c. — "the yes/no counter"

4d. — "which choice wins?"

4e. The derivative — the tool that finds the best number

For regression the parent takes a derivative. Here is why that tool and not another.

Figure — Decision tree structure and terminology

4f. — "how many"


5. Family words: root, parent, child, depth

These are relationship words, not new maths.


Prerequisite map

Samples dots on a grid

Features the axes

Targets colour or number

Subscripts xj and yi which one

Test xj le t a line

Regions hyper-rectangles

Membership i in R box

Summation add them up

Indicator counts mistakes

Argmax majority vote

Derivative finds the mean

Decision Tree structure 2.3.1


Where each piece is used next

  • The test and regions feed CART algorithm (how splits are searched) and Gini impurity and entropy (how a split is scored).
  • Depth and subtree feed Overfitting and pruning.
  • The staircase boundary is smoothed by Random Forests and corrected by Gradient Boosted Trees; the depth/complexity story connects to Bias-variance tradeoff.
  • Return to the parent: parent topic.

Equipment checklist

Self-test: can you answer each before revealing?

What does a subscript like tell you?
Which sample — it points at "sample number " and its true target.
What is the difference between the index and the index ?
points at a sample (a dot); points at a feature (an axis).
Read in plain words.
"Sample is one of the dots inside region (box) ."
Geometrically, what shape is the test ?
A straight line perpendicular to axis (vertical or horizontal), splitting dots into yes/no.
Why can't a standard split use ?
That line is diagonal (uses two features at once); standard splits are axis-aligned, one feature at a time.
What is a hyper-rectangle?
A box whose sides are parallel to the axes — a leaf's region in any number of features.
What happens if a leaf's region is empty, ?
The mean formula would divide by zero, so such splits are rejected or the leaf inherits its parent's prediction.
What does (with a hat) mean versus ?
is our prediction/estimate; is the true value.
What does compute, and why sum it over ?
It is 1 when the guess is wrong, 0 when right; summing over the leaf's dots counts total mistakes in that leaf.
What does return, and how do you break a tie?
The class with the most dots; ties are broken by a fixed deterministic rule (e.g. lowest class index).
Why use a derivative to find a regression leaf's prediction?
The minimum of the error bowl has zero slope; setting the derivative to 0 locates that flat bottom → the mean.
What does count, and what must it be for the mean formula?
The number of dots in region ; it must be at least 1 to avoid dividing by zero.
How is tree depth measured?
By counting edges (arrows) on the longest root-to-leaf path, not nodes.