Decision Tree

Last updated October 1, 2026

What is a Decision Tree in simple terms?

In simple terms, a decision tree is a flowchart of questions. It asks one thing, then the next depending on your answer, narrowing step by step until it lands on a conclusion — like troubleshooting why a car won't start.

Decision Tree explained

A decision tree is a machine learning model that makes a prediction by asking a sequence of simple yes/no questions about the data, branching at each answer until it reaches a final decision — much like a flowchart learned automatically from examples.

A decision tree predicts an outcome by working through a series of simple questions, each one narrowing the possibilities. Start at the top with all your data, ask a question that best splits it — "is the applicant's income above a threshold?" — and send each example down one branch or another based on the answer. At each new branch, ask another question, and another, until you reach the bottom: a leaf that gives the final answer, such as "approve the loan" or "this email is spam." Drawn out, it looks like an upside-down tree, branching from a single root into many leaves. The appeal is that you can read the whole thing like a flowchart and follow exactly why any decision was made.

What makes it a machine learning model, rather than a flowchart someone wrote by hand, is that the tree builds itself from examples. Given a pile of past data with known outcomes, the algorithm figures out which question to ask first — the one that most cleanly separates the outcomes — then repeats the process within each branch, choosing the next most useful question, and so on. Nobody tells it that income matters more than the day of the week; it discovers that from the data by seeing which splits sort the examples best. The result is a set of learned if-then rules you can inspect, which is why decision trees are prized when you need to explain a model's reasoning, not just trust its output.

The catch is that a single tree, left to grow unchecked, tends to memorize its training data — carving out ever-finer branches for every quirk until it fits the examples perfectly but stumbles on anything new. That's overfitting, and it's the classic weakness of decision trees. The usual fixes are to "prune" the tree back to its genuinely useful questions, or to combine many trees into an ensemble, which is exactly what a random forest does. So while a lone decision tree is wonderfully clear and a great place to start, its real power often shows up when many trees pool their answers.

Real-world example of a Decision Tree

One of the first models many people ever build is a decision tree trained on the passenger list of the Titanic, the dataset behind Kaggle's long-running beginner competition. Given each passenger's details and whether they survived, the tree has to choose its own first question, and with the usual settings it picks sex, because in that training data about 74% of women survived compared with about 19% of men. Further down, it splits on ticket class and on age, and picks up that young boys fared far better than adult men. That is exactly why beginners are shown it: every prediction can be traced, question by question, to a reason a person can read and check.

Frequently asked questions about Decision Trees

What is the difference between a decision tree and a random forest?

A decision tree is a single flowchart of learned questions — easy to read and explain, but prone to overfitting, meaning it can latch onto quirks of its training data and do worse on new cases. A random forest is a crowd of many different decision trees that vote on the answer. Pooling many trees smooths out the mistakes any one of them makes, giving stronger, more reliable predictions. The trade-off: a single tree you can read at a glance; a forest is more accurate but far harder to inspect, since you'd have to read hundreds of trees at once.

How does a decision tree work?

During training, the algorithm scans the examples and picks the question that best separates the different outcomes — the split that leaves each branch as "pure" (one-outcome-dominated) as possible. It then repeats that within each branch, choosing the next most useful question, growing the tree until the branches are clean enough or a stopping rule kicks in. To make a prediction, you drop a new example in at the top and let the answers route it down the branches to a leaf, which gives the verdict. Often the tree is then pruned — trimmed back — to remove over-specific branches that hurt accuracy on new data.

What is a decision tree used for?

Decision trees handle both classification (sorting into categories, like approve/decline) and regression (predicting a number, like a price). They're especially valued where the reasoning must be transparent and auditable — credit scoring, medical decision support, eligibility rules — because you can show the exact path to any decision. They also serve as the building blocks of powerful ensemble methods like random forests and gradient-boosted trees, so even when they're not used alone, they're working under the hood of some of the most effective models in practice.