18 min total

Machine Learning

Decision trees & ensembles

Decision trees & ensembles

Regression with decision trees

Decision trees and ensembles — illustration

One decision tree can be very sensitive to very small changes in data

Make many trees and form an ensemble tree

Make different decision trees, average out the results

Use sampling with replacement technique to generate dataset from the original dataset

Sampling with replacement: randomly selecting data points from a dataset, where each selected point is put back into the pool before the next draw and so it can be selected again. each data point can be chosen multiple times or not at all

You may make 64-128 different trees (splits) and combine them to form a bagged tree

In a bagged tree you pick the most voted prediction

Random forests

To further diversify the trees, at each node, instead of considering all features for the split, a random subset of K features is chosen.

From these K features, the one with the highest information gain is selected for splitting the node.

Typical Choice for K: When the total number of features N is large, K is often chosen as ​

Random forests lead to more diverse and robust trees

Bagging, boosting, and XGBoost

(eXtreme Gradient Boosting)

In bagging, each decision tree in the ensemble is built independantly, boosting focuses on building each upcoming tree to improve upon the errors of previous trees.

Bagging: build multiple independent models in parallel using random subsets of training data then aggregate their predictions

Boosting directs more attention to examples that previous trees misclassified

By assigning higher probability to misclassified examples making them more likely to be included in next training set

Boosting: Train models sequentially, each model corrects the mistakes of its predecessor

No sampling with replacement included here

XGBoost adjusts weights of training examples focusing more on hard-to-classify cases directly

XGBoost uses gradient boosting framework, which optimizes model by minimizng a loss function

Includes regularization terms to prevent overfitting