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.
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
- What Machine Learning Classification Is, and Where It Fits in SEO
- Synthetic vs User Query Classification Notebook (resource).
- Complete Guide Understanding ML Classification for Marketers (resource).
- Introduction to Machine Learning for SEO course, lesson “What is classification?”.
- Semantic ML-enabled Keyword Research course
Where Random Forest shows up on MLforSEO
Learn it in a course
Read about it on the blog
Sources and further reading
Other terms from ML Models & Algorithms
- BERT (Bidirectional Encoder Representations from Transformers)Google's 2018 transformer language model that reads text in both directions to produce context-aware embedding…
- BERTopicA modular topic modelling technique that clusters transformer embeddings and labels each cluster with class-ba…
- BIRCH (Balanced Iterative Reducing and Clustering using Hierarchies)BIRCH (Balanced Iterative Reducing and Clustering using Hierarchies) clusters very large numeric datasets by s…
- BM25A classic ranking function that scores documents by how often query words appear, adjusted for word rarity and…
- Boyer-MooreA fast exact string-search algorithm that compares a pattern from right to left and skips ahead after mismatch…
- c-TF-IDFClass-based TF-IDF: treats each cluster as one document to find the words that best describe it, used by BERTo…
- Centroid-based ClusteringA clustering family that groups data around central points (centroids), each the average of its cluster's memb…
- Convolutional Neural Network (CNN)A deep learning architecture that scans data with small learned filters to detect local patterns; the classic…
- DBSCANDensity-based clustering that groups closely packed points, finds the number of clusters itself and labels iso…

