Random Forest

A random forest is a machine learning model that combines many decision trees and averages their predictions, producing results that are usually more accurate and less prone to overfitting than a single tree.

Data & AI

Each tree is trained on a random subset of the data and features, so the trees make different mistakes. By voting or averaging across all of them, the forest cancels out individual errors — a technique called ensemble learning.

It's like asking a large crowd of diverse experts and going with the majority opinion: any one person might be wrong, but the group is usually right. Random forests are a popular, reliable choice for many real-world tasks.

Examples

Python

from sklearn.ensemble import RandomForestClassifier

rf = RandomForestClassifier(n_estimators=100).fit(X_train, y_train)
print("trees:", len(rf.estimators_))

Output:

trees: 100

Learn it in a lesson

See also

Back to the Dictionary