Skip to main contentSkip to navigationSkip to footer
DigiTransact AI Education Centre Start Learning

Level 2 · Module 10 · 10 minutes

Decision trees: asking questions one after another

What you will learn
  • Explain how a decision tree turns features into a chain of yes-or-no questions.
  • Explain why deep trees overfit and what pruning or limits change.
  • Compare a single tree with a forest or boosted group in plain terms.

A decision tree predicts by asking a series of yes-or-no questions about a case. Each question sends the case down a branch until it reaches an answer. The questions are chosen during training so that each one separates the examples as neatly as possible. A small tree is easy to read aloud, which makes it popular with people who must explain a decision.

How a tree is built

Training looks at the features and tries simple splits. For a delivery-lateness model it might ask whether the distance is above a certain level, or whether the carrier's past record is weak. It keeps the split that best separates late from on-time examples, then repeats the process inside each branch. The result is a flowchart learned from data.

Choosing the splits and their order is the learning. Nobody writes the final questions by hand, and the tree can find combinations a person would not think to test.

Where trees go wrong

A tree that keeps splitting can memorise quirks of the training data, producing a different question for every small detail. Deep trees usually score well on their training examples and poorly on new ones. Grow shorter trees, limit how many questions a path may contain, or prune weak branches, and generalisation usually improves.

Many trees together

Two common extensions trade some readability for reliability. A random forest trains many trees on slightly different samples and lets them vote, which reduces the chance that one odd tree decides. Boosting trains trees one after another, each one concentrating on the cases the earlier trees got wrong.

A good default for tables

Trees suit tables of mixed features, need little preparation, and show their reasoning. They are also unstable: a small change in the data can produce a different tree. That is why the ensemble version is common in commercial work, where accuracy matters but a readable explanation is still needed for review.

Practice versus real training

Drawing a small tree by hand is a simplified teaching picture of how a tree is built. A real model is grown by software over many rows and measured on held-out data. No model is trained in this lesson.

Common misconception

A decision tree must be grown as deep as possible, because more questions mean more knowledge. Extra depth lets a tree fit noise and rare quirks. A deep tree can look perfect on its training examples while failing on new cases. Limits, pruning and groups of trees are used to keep decisions general rather than memorised.

Guided practice

Draw a yes-or-no tree on paper for deciding whether a hypothetical parcel is likely to arrive late. Use at most four questions, then test it on five made-up parcels written on cards. Count the wrong answers, redraw the tree with one fewer question, and compare. Explain which version you would trust on new parcels. No software is used and no model is trained.

Knowledge check

1. What is chosen during training of a decision tree?

2. Why does a very deep tree usually generalise poorly?

3. What does a random forest do?

Independent practice

Write a short example from your own work or daily life and decide whether it is AI, ordinary software or a mixture. Then explain why. Save it in your notes; no account is required.

Last reviewed: · Report a problem

Last updated: