ML Models & Algorithms

Random Forest

In shortA supervised algorithm that trains many decision trees on random samples of the data and combines their votes, for more accurate, stable predictions.

Updated 24 Oct 2026· 2 min read

A random forest is a supervised machine learning algorithm made of many decision trees. Each tree makes its own prediction, and the forest combines them: the most common answer wins for classification, and the average is used for regression. Combining many slightly different trees makes the result more accurate and less prone to overfitting than any single tree.

How it works

The algorithm, introduced by Leo Breiman in 2001, adds randomness in two places. Each tree is trained on a random sample of the rows (drawn with replacement, known as bootstrapping), and at each split a tree only considers a random subset of the features. The trees therefore make different mistakes, and when their votes are pooled, many of those mistakes cancel out. This “ensemble” approach is why a forest usually beats a single deep tree that has memorised its training data.

Random forests also report feature importance: how much each input contributed to the predictions. That makes them easier to interpret than many deep learning models, which is useful when you need to explain results to stakeholders.

How it’s used in SEO and marketing

  • SEO performance prediction: will this page rank in the top 10? Answered yes or no from features such as content length, title structure, search volume and competitor data.
  • Classifying queries or pages, such as search intent or page type.
  • Customer lifetime value and churn prediction from behavioural data.
  • Content recommendations based on what similar users engaged with.

Example

In MLforSEO’s Semantic ML-enabled Keyword Research course, a notebook distinguishes user-typed queries from AI-generated synthetic queries. A rule-based pass handles obvious cases; for more accuracy, a Random Forest trained on labelled query examples learns which combinations of features (length, question words, structure) matter most, rather than relying on hand-written rules.

Limitations and things to watch

  • It needs labelled data. Without known answers for a sample, you cannot train it.
  • On imbalanced data (few pages in the top 10), it can over-predict the majority class. Check precision and recall alongside accuracy.
  • It works on tabular features. For raw text, you first turn text into features such as TF-IDF or embeddings.
  • Feature importance shows what the model relied on; it does not prove what causes rankings.
  • Large forests can be slow to predict at scale; tune the number and depth of trees.

Learn it on MLforSEO

Where Random Forest shows up on MLforSEO

Sources and further reading

Other terms from ML Models & Algorithms

See all 50 ML Models & Algorithms terms →