AI Glossary / AI and machine learning / Intermediate

Decision tree pruning

Definition

Decision tree pruning is the practice of cutting branches off a grown decision tree so it stops memorizing the training data's noise and predicts new cases better.

What it means

A tree allowed to grow without limit will keep splitting until each leaf holds a handful of examples, or even one. At that point it has memorized, not learned, and its rules will not survive contact with new data.

Pruning removes the branches that do not earn their keep. A split that helped on the training data but does not help on fresh data is cut, and the tree is replaced by the simpler tree that remains.

There are two timings. Pre-pruning stops the growth early, for instance by refusing splits with too few examples; post-pruning grows the full tree first and then trims it back using held-out evidence.

The result is almost always a smaller tree with worse training accuracy and better real accuracy. That trade is the entire point, and reporting training accuracy after pruning is a category error.

For a business, pruning is the difference between a triage rule staff can trust and a tangle of special cases that breaks the first time conditions change.

How it works

Grow the tree, or take an existing grown tree, and set aside validation data the tree never learned from.

For post-pruning, consider removing each branch in turn and check whether the smaller tree predicts the validation data at least as well; keep the removals that do not hurt.

A common formal version, cost-complexity pruning, scores each candidate tree on accuracy minus a penalty per leaf, so the search favors trees that are both accurate and small.

For pre-pruning, enforce stopping rules during growth: minimum examples per leaf, maximum depth, or a minimum improvement a split must deliver.

Finish by confirming the pruned tree on a final untouched test set, because the validation data used to guide pruning is no longer neutral evidence.

Three practical examples

  • Credit policy: trimming a 200-leaf approval tree to 30 leaves so auditors can review every rule it applies.
  • Demand forecasting: pre-pruning a store-level tree at depth six to stop it fitting one-off promotional spikes as if they were laws.
  • Fraud triage: post-pruning branches that split on rare device types seen only a handful of times in training.

Think of it this way

Think of editing a speech. The first draft includes every anecdote that ever got a laugh; the edit removes the ones that only worked for that one audience. What remains is shorter, lands better with new audiences, and says the same thing.

The limit: cut too aggressively and you remove real substance. Over-pruning underfits, so the validation check is what keeps the edit honest.

Worked example

pruning a claims triage tree

Suppose an insurer's triage tree has 180 leaves and scores 94 per cent on training claims but 71 per cent on new ones. The figures are illustrative.

The team prunes bottom-up: removing each branch whose absence does not reduce validation accuracy, one branch at a time, checking after each cut.

The pruned tree has 34 leaves, scores 83 per cent on training and 82 per cent on new claims. Training accuracy fell and real accuracy rose.

Staff can now read the whole tree in one meeting, and the claims team trusts it enough to act on its routing.

Illustrative case study

A fictional retailer let a forecasting tree grow until each promotion, holiday and quirk of 2019 had its own branch. Forecasts for 2020 were hopeless, and the team initially blamed the data.

A pruning pass with a per-leaf penalty shrank the tree by 80 per cent and immediately improved forward forecasts, because only patterns that repeated survived.

The invented lesson: branches are claims, and every claim costs credibility. Pruning deletes the claims the data cannot back twice.

Common misconceptions and mistakes

  • Pruning is a repair for bad data. It is needed even with perfect data, because unpruned growth overfits by construction.
  • Pre-pruning and post-pruning give the same tree. Stopping early and trimming later search differently, and post-pruning usually finds the better tree.
  • A pruned tree is the true tree. It is a simpler bet that generalizes better; a different sample could justify a different pruning.

Business use

Budget for pruning in any tree project: the grown tree is the raw material, not the deliverable.

Keep a validation set reserved for pruning decisions and a separate test set for the final honest score; mixing them flatters the result.

When a stakeholder asks why the published tree scores lower than the demo did, the pruning story is your answer, and it is a good one to have rehearsed.

People also ask

Does pruning change the fields the tree uses?

Often. Fields whose splits only helped on noise lose their branches and drop out of the final rules.

Can forests be pruned?

Individual trees in a forest are usually left unpruned, because the averaging across trees controls the overfitting instead.

How much smaller does a pruned tree get?

Commonly half to a tenth of the grown size, depending on how noisy the data is.

Check your understanding

What is the expected effect of pruning on training accuracy and on accuracy on new data?

Answer: Training accuracy usually falls slightly while accuracy on new data rises, because the removed branches were fitting noise rather than pattern.

Related terms

  • Decision tree
  • Decision forest
  • Overfitting
  • Validation set
  • Generalization
  • cost-complexity pruning

Learn next

AI for Business Owners covers how to read model accuracy claims and what questions to ask before trusting a vendor's numbers: https://aiforbusinessandlife.com/academy/ai-for-business-owners. [C2]

More in AI and machine learning

  • Data type - A data type describes what kind of value a column or field holds, such as whole number, decimal, text, date or true-false, and decides what you can do with...
  • Dataset shift - Dataset shift is a difference between the data distribution used to develop a model and the distribution encountered during evaluation or use.
  • Decision boundary - A decision boundary is the dividing line, or surface, in the space of inputs where a classifier switches from predicting one class to another, such as the...
  • Decoder - A decoder is the part of a model that turns an internal numeric representation back into an output people can use, such as words, images or predictions.
  • Deep Q-Network - A Deep Q-Network is a reinforcement learning system that uses a neural network to estimate the value of each available action in a given situation, so the...
  • Deep tomographic reconstruction - Deep tomographic reconstruction uses deep-learning methods to recover an internal image or volume from indirect measurements.

Sources

[S1] Russell and Norvig, AIMA glossary. Full URLs are in the source ledger. Verified 11 October 2026.

Previous: Decision tree Next: Deck imputation

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer