A random forest is Bagging applied to Decision trees with extra feature-subsampling at each split.
Why subsample features if bagging already randomizes data?
Pure bagging can leave one very informative feature dominating every tree, so the bootstrapped trees stay highly correlated. Random feature subsets at each split decorrelate them further.
Algorithm
-
For bootstrap-sample datasets of size
-
Grow a random-forest tree by recursively repeating the following steps for each terminal node of the tree until the minimum node size is reached
- look at a random subsample of features and pick the best among those
- Typical choice:
- Split the node into two daughter nodes
- look at a random subsample of features and pick the best among those
-
Generate the ensemble of trees .
-
Aggregate the individual results:
- Regression (average across all trees):
- Classification (majority vote of the class predictions):
Standard decision tree: at each split, look at all features and pick the best.