A deep decision tree chases every noisy point and wobbles when the data changes. Bagging resamples the data, grows many trees, and averages them. The wobble cancels and the curve calms down.
A bootstrap sample draws n points with replacement: some points appear twice or more, and others are left out entirely. Each square below is one training point, in left-to-right order. Hollow squares were not drawn for this tree. Their stored predictions come later: those are the out-of-bag points. The inspected tree is also drawn in violet in the lab.
The test error of the average falls quickly as trees are added, then levels off: past a point, more trees cost time but add little. The out-of-bag error is a free estimate that uses no test data, because every tree is scored on the points it never saw. It is usually in the same ballpark as the test error, but with few points or few trees it can be noticeably higher or lower. The dashed line is one tree trained on all the data. Click the chart to set the number of trees.
Averaging removes wobble, but it cannot make a too-simple model smarter. This table compares one tree with a bagged crowd at each depth, using your current number of trees and sample size. Deep trees (high variance) gain a lot; stumps (high bias) gain almost nothing. Click a row to use that depth.
With several input features, random forests add one more trick: each split looks at only a random subset of features, so the trees are even less alike and the average is even steadier.
A single depth-8 tree on noisy data. It builds a staircase through every noisy point, so test error is high.
Same data, same depth, but 60 bootstrap trees. The jagged steps blend into a smooth curve and test error falls.
Depth-1 stumps, 60 of them. The average is still crude, because bagging cannot add flexibility the trees don't have.