Decision tree
A decision tree is a machine learning model that makes predictions by asking a sequence of questions about the input, following branches until it reaches an answer at a leaf.
A decision tree looks like a flowchart. To assess a loan application, it might first ask whether income is above a threshold, then, depending on the answer, whether existing debt is high, and so on until it reaches a leaf that gives a prediction. Google's glossary describes it as a supervised learning model made of conditions and leaves arranged in a hierarchy. Classification trees predict a category, such as approve or decline; regression trees predict a number, such as a house price.
Trees are learned from labelled examples, top down. At each step the algorithm picks the question that best separates the training data, measuring purity with Gini impurity in the CART method or information gain in the ID3 and C4.5 family, and for numbers by how much the split reduces variance. It repeats on each branch until a stopping rule applies. Finding the best possible tree is NP-complete, so practical algorithms make the locally best choice at each step without any guarantee of the best overall tree.
The main methods date from the 1980s. Leo Breiman, Jerome Friedman, Richard Olshen and Charles Stone published CART, short for classification and regression trees, in 1984, and Ross Quinlan's ID3 and its successor C4.5 developed the information-gain approach. The widely used scikit-learn library implements an optimised version of CART.
The appeal is transparency. A tree is a white box: every prediction can be traced as a path of plain conditions, which matters when a decision must be explained to a customer or a regulator. Trees also need little data preparation and make predictions quickly. Their weaknesses are just as clear. Deep trees overfit, memorising quirks of the training data. Small changes in the data can produce a very different tree. And because predictions are constant within each region, trees extrapolate poorly beyond the range of values they were trained on.
Combining many trees fixes much of this. Random forests average trees trained on random samples of the data, and gradient boosting adds trees one at a time, each correcting the errors of those before. These ensembles are usually much more accurate than a single tree, at the cost of the single tree's readability.
It splits data with a series of questions about the input features, such as whether a value is above a threshold. Each answer leads down a branch to the next question until the path ends at a leaf holding a prediction. The questions are chosen during training to separate the examples as cleanly as possible. They are easy to understand and explain, need little data preparation and are fast to use. On the other hand, they overfit easily, can change a lot with small changes in the data and cannot predict values outside the range they saw in training. Limiting the depth or using ensembles reduces these problems. A random forest is many decision trees trained on random samples of the data and features, whose predictions are combined by voting or averaging. It is usually much more accurate and stable than one tree, but you can no longer read off a single simple path explaining each prediction. Yes, especially in ensemble form. Random forests and gradient-boosted trees are common for tabular data such as financial records and customer data, and a single shallow tree remains one of the most interpretable models available. Large language models and image systems, by contrast, use neural networks.Common questions
How does a decision tree work?
What are the advantages and disadvantages of decision trees?
What is the difference between a decision tree and a random forest?
Are decision trees used in modern AI?
Search for "decision tree learning", "CART Gini impurity" or "decision tree vs random forest" to see how trees are built and compared. The scikit-learn user guide, statistics and machine learning textbooks and university course notes are reliable sources. Be wary of claims that a tree-based model is fully explainable when it is actually an ensemble of hundreds of trees.Finding more
Working out what this means for your business?
Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.