Foundations — Random forest algorithm
This page assumes you know nothing. Before you can read the parent note's variance formula or its OOB derivation, you must own every letter, ratio, and squiggle it throws at you. We build them one at a time, each on top of the last.
0. The characters in this story (a first look)
Every symbol below will reappear in the parent note. Meet them once here so nothing is a surprise.
| Symbol | Plain words | Lives where |
|---|---|---|
| how many rows (examples) we have | the data table's height | |
| how many features (columns/clues) each example has | the data table's width | |
| the -th example's clues | one row | |
| the -th example's true answer/label | one cell | |
| how many trees in the forest | count of learners | |
| the prediction of tree number | one tree's output | |
| the average of all tree predictions | the forest's final answer | |
| how spread out one tree's predictions are | "moodiness" of a tree | |
| how alike two trees' answers are (correlation) | agreement between trees | |
| how many features a tree may peek at per split | a small piece of |
We now earn each of these, in order.
1. Data as a table: , , rows and columns
Picture a spreadsheet. Every row is one example (one animal, one house, one patient). Every column is one feature — a measured clue about that example.

- (read "x sub i") means: take row number — all its clues bundled together. The little underneath is just an address label ("which row"), like a seat number.
- (read "y sub i") means: the true answer sitting in row .
2. A decision tree: the single "moody expert"
Before a forest you need one tree. A decision tree is a flowchart of yes/no questions. Each question splits the examples into two groups; you keep asking until a group is pure enough to guess a label.

The tree chooses each question to make the two resulting groups as pure as possible (mostly one label). "Purity" is measured by Gini impurity or entropy — you don't need the formula here, only the idea: a good split separates the classes.
3. Prediction, and why one tree is "high variance"
Run a tree on a new example ; it walks the flowchart and lands in a leaf. That leaf's guess is the prediction, written — "the answer of tree for input ."
Now the key personality trait: variance.

4. Averaging: and the summation symbol
The forest's answer is the average of all its trees. Two pieces of notation carry this.
5. Correlation : how alike two trees are
Averaging only helps if the trees disagree in their mistakes. If every tree makes the same error, averaging their identical wrong answers still gives that wrong answer. We measure "sameness of answers" with correlation.

6. Bootstrap sampling: , "with replacement", and
Two last tools power the randomness.
Bootstrap sample — draw rows from your rows with replacement: after picking a row you put it back, so it can be picked again. Some rows appear twice, some not at all.
out of features — at each split a tree may only look at a random handful of the features. Typical . This forces trees onto different clues → lowers .
The expression — this shows up in the OOB derivation. Read it as: one draw misses a fixed row with chance ; do that independent times → multiply → . As grows this settles onto a famous number:
The prerequisite map
Read top to bottom: the table feeds the tree; the tree gives predictions with variance; averaging pools them; bootstrap and feature-subsetting control correlation; all of it converges on the forest.
Equipment checklist
Self-test: cover the right side, answer, then reveal.
What does count, and where do you see it in the table?
What does count?
Read and in words.
What is a split in a decision tree?
What does variance measure for a tree?
Why do we square the gap from the mean in variance?
Expand .
What does the bar in mean?
What does mean for two trees, and why is it bad?
What does "with replacement" mean?
What is ?
What number does approach, and to what value?
Connections
- Parent: Random Forest Algorithm — where all these symbols get used.
- Decision Trees — the base learner, section 2 here.
- Bagging (Bootstrap Aggregating) — the row-resampling, section 6.
- Bias-Variance Tradeoff — why high-variance trees are worth averaging, section 3.
- Gini Impurity & Entropy — how a split's purity is measured, section 2.
- Cross-Validation — what the left-out (OOB) rows replace, section 6.
- Feature Importance — a later payoff once you own and features.
- 2.3.07 Random forest algorithm (Hinglish) — same topic in Hinglish.