Study Atlas › Computer Science › Machine learning

Decision trees and ensemble methods

Trees split data by feature thresholds; ensembles (random forests, gradient boosting) combine many trees for accuracy.

Edited by Alex C, EduAlx · Sources cited below

Explanation

Trees pick splits that reduce impurity (Gini or entropy). Breiman's random forests (2001) average trees on bootstrap samples with random feature subsets. Gradient boosting (Friedman, 2001; XGBoost, 2016) adds trees that fix previous errors and often wins on tabular data.

Example

Credit scoring and fraud detection often use gradient-boosted trees.

Code

from sklearn.ensemble import RandomForestClassifier
clf = RandomForestClassifier(n_estimators=300).fit(X_train, y_train)
print(clf.score(X_test, y_test))

How it works, step by step

  1. Choose the best split at each node
  2. Grow until a stopping rule
  3. Build many trees on resampled data
  4. Average or vote predictions

Open the interactive page with diagrams →

People behind it

References

  1. L. Breiman, Mach. Learn. 2001, 45, 5–32.
  2. J. H. Friedman, Ann. Stat. 2001, 29, 1189–1232.

Textbooks

Related topics

Clustering and unsupervised learningReinforcement learningPython programming essentialsNatural language processingTesting and debuggingComputer vision and convolutional neural networksHuman–computer interaction and usabilitySearch engines and PageRankError-detecting and error-correcting codesWeb development: front end and back end