Classification tree

The following techniques are applied to the two outcomes: 2 and 7 again.
The classification tree allow us to use a higher number of predictors and also allow these regions to take more complex shapes, by partitioning the predictor space.
It uses cross-validation to find the best complexity parameter (cp) for the model, calculated by the Gini Index or the Entropy.

Random Forest

Random Forest improves prediction performance and reduces instability of decision tree by averaging multiple decision trees, obtained through bootstrap samples.

One significant metric for random forest is the variable importance. However since this example uses only 2 predictors, both will be important. Here the upper left quadrant (x_1) is more important than the lower right quadrant (x_2).