Decision trees explained in plain terms means understanding the machine learning model that works like a flowchart: ask a question, follow the answer, ask another, until you reach a decision. The central question is how a computer can make a judgement it can also explain, and the answer is to split the data, step by step, on the questions that separate the answers most clearly.
A decision tree is a supervised machine learning model that predicts an outcome by passing each example through a series of yes-or-no questions. Each question splits the data into two groups, and the process repeats until each group is mostly one answer, at which point the tree predicts that answer for anything that lands there.
The idea is simple: divide and decide. A tree that predicts whether to lend money might first ask about income, then about existing debts, then about repayment history, and each leaf of the tree holds a decision, such as approve or refuse, with the path to it showing exactly why. This article explains what decision trees are, how they work, and where they are used.
Key takeaways
- Decision trees predict by asking a series of questions about the data.
- Each split is chosen to separate the answers as cleanly as possible.
- They handle numbers, categories, and missing values naturally.
- The whole model can be drawn and read, like a flowchart.
- They suit problems where explanations matter as much as accuracy.
What decision trees are
A decision tree has three kinds of parts. The root is the first question, asked of every example. Internal nodes are further questions, each splitting the examples that reach them. Leaves are the ends, each holding a prediction: a category, such as approve, or a number, such as a predicted price, usually the average of the examples that reached that leaf.
The tree is built by choosing, at each node, the question that best separates the answers. For classification, the usual measures are Gini impurity and information gain, which both reward splits that make each side purer, meaning mostly one answer. For regression, the split is chosen to reduce the variance of the numbers on each side.
Trees are easy to read, which is their great advantage. A doctor, a loan officer, or a regulator can follow the branches and see exactly why a decision was made, which is why trees are used wherever a model must be explained, not just trusted. Our guide to anomaly detection explains how models spot the unusual cases a tree might miss, and our guide to feature engineering explains how the questions a tree asks are chosen and shaped in the first place.
How decision trees work
Training starts with all the examples at the root. The algorithm tries every possible split, on every input, and picks the one that best separates the answers, measured by impurity for categories or variance for numbers. The data is divided, and the process repeats on each side, growing the tree branch by branch.
Growth stops when a rule says to stop: when a node holds too few examples, when the answers in it are already pure, or when a maximum depth is reached. Without such rules, a tree would keep splitting until every leaf held a single example, memorising the training data perfectly and predicting new data badly.
Pruning fixes overfitting after the fact. The tree is grown large, and then branches that do not improve predictions on held-back data are cut away, leaving a smaller tree that generalises better. Pruning is usually done with a validation set, or by cross-validation, which tests the tree on data it was not trained on.
Prediction is a walk down the tree. A new example starts at the root, answers each question in turn, and follows the matching branch until it reaches a leaf, where the prediction waits. The path itself is the explanation, and it can be printed, drawn, or turned into a set of plain-language rules.
Trees also handle awkward data gracefully. They need no scaling of inputs, they accept categories directly, and they can route around missing values by sending an example down the branch that best matches what is known. That robustness is one reason they are often the first model tried on a new dataset.

Comparing decision trees with other models
Decision trees are one of several predictive models, and each suits a different problem. Linear regression fits a straight line, random forests combine many trees, and neural networks learn complex curves, but each has its own trade-offs.
The table below sets out the main contrasts between the leading approaches.
| Aspect | Decision trees | Linear regression | Random forests |
|---|---|---|---|
| Predicts | Categories or numbers | Numbers, on a line | Categories or numbers |
| Interpretability | Very clear, a flowchart | Very clear, slopes explain | Poor, many trees at once |
| Accuracy | Moderate, one tree | Good when linear | High, averages many trees |
| Overfitting | Prone, needs pruning | Rare, simple model | Resistant, by averaging |
| Best for | Explainable rules | Simple, straight-line data | Accuracy without tuning |
The practical result is that a single tree is the right choice when the decision must be explainable, linear regression wins for simple straight-line relationships, and random forests are the choice when accuracy matters more than reading the model.
Where decision trees are used
Credit scoring is a classic use. A bank’s tree asks about income, debts, and repayment history, and its branches show exactly why an application was approved or refused, which matters both for the customer and for regulators who demand explanations.
Medicine uses trees for diagnosis and triage. A tree might ask about symptoms, test results, and age, and its leaves suggest a diagnosis or a next step, with the path showing the reasoning a clinician can check and challenge.
Marketing uses trees to find customer segments. A tree splits customers by behaviour, such as how often they buy and how much they spend, and the leaves describe groups that respond to different offers, which guides campaigns.
Manufacturing uses trees to predict faults. Sensor readings are split on thresholds, and the leaves say whether a machine is healthy or about to fail, giving engineers a rule they can act on without understanding the model in detail.
Fraud detection uses trees as a first line of defence. A transaction is passed down a tree that asks about amount, location, and history, and suspicious leaves trigger a review, with the path explaining why the transaction was flagged.
Strengths and limits
The greatest strength of decision trees is their transparency. The model is a picture anyone can follow, and its decisions can be turned into rules a person can read, check, and argue with, which is why trees survive in regulated industries where a black box would not be accepted.
It is also a strength that trees need little preparation. They accept numbers and categories, need no scaling, handle missing values, and capture interactions between inputs naturally, since a later question can depend on an earlier answer.
The limits are real, though. A single tree is often less accurate than an ensemble, it can be unstable, since a small change in the data can produce a very different tree, and it struggles with smooth relationships, approximating a curve with a staircase of splits. Those limits are why trees are often used as building blocks, not as the final model.
Decision tree checklist
- Start with a single tree, and check it can be drawn and read.
- Limit depth, so the tree stays small enough to explain.
- Prune with held-back data, and check accuracy improves.
- Handle missing values deliberately, not by accident.
- Check the leaves, since tiny leaves are usually noise.
- Compare against a random forest, to see what accuracy costs.
- Watch for instability, and retrain if the tree changes wildly.
- Turn the paths into rules, so non-specialists can use them.
- Test on new data, since a tree that memorises is worse than useless.
Frequently asked questions
What is a decision tree in simple terms?
A decision tree is a model that makes predictions by asking a series of questions. Each answer leads to the next question, until the tree reaches a leaf that holds the prediction, and the path shows why that answer was chosen.
What is the difference between a decision tree and a random forest?
A random forest is many decision trees trained on different samples of the data, whose predictions are averaged or voted on. It is more accurate and more stable than one tree, but it cannot be drawn and read like a single tree can.
What is Gini impurity?
It is a measure of how mixed the answers are in a group of examples. A pure group, with one answer, has an impurity of zero, and the tree chooses splits that reduce impurity the most.
What is pruning?
Pruning is cutting away branches that do not improve predictions on new data. A tree is grown large and then trimmed back, which stops it memorising the training data and helps it generalise.
Can decision trees predict numbers?
Yes. A regression tree predicts a number at each leaf, usually the average of the training examples that reached it, and it splits to reduce the variance of the numbers on each side.
When should I use a decision tree?
When the decision must be explainable, when the data mixes numbers and categories, and when a simple, readable model is worth a small loss of accuracy. For maximum accuracy, an ensemble is usually better.
The bottom line
Decision trees explained in one line is this: a flowchart learned from data, where each question splits the examples until every leaf holds an answer, and the path to it is the explanation.
They are the most readable model in machine learning, and they remain the starting point for any problem where a decision must be justified, as well as the building block of the forests and boosting methods that win competitions.
This article is general information about how decision trees work, not advice about building models for a particular problem.







