← Machine Learning for EveryoneToolsInVisionLearning Center
Decision Trees in Depth · Lesson 27

Prune a Tree Before It Memorizes Noise

A deep tree creates one leaf for nearly every unusual trip.

Watch the lesson

Prune a Tree Before It Memorizes Noise explained visually

1:06

A deep tree creates one leaf for nearly every unusual trip. English captions are optional and start off. The complete transcript follows the written lesson.

Lesson overview

What you will learn

A deep tree creates one leaf for nearly every unusual trip.

  1. A practical question
  2. The useful idea
  3. Work through the example
  4. Limits and next step
01

A practical question

The tree now has a branch for one particular rainy Tuesday. It predicts every training trip perfectly, yet warnings on new days are poor. The branch may have learned an accident of the sample rather than a repeatable pattern.

02

The useful idea

Limit depth or minimum leaf size, or prune branches whose extra complexity does not improve validation performance. Choose these settings without touching the final test set. Compare train and validation errors as the tree grows. If training keeps improving while validation worsens, extra detail is hurting generalization.

03

Work through the example

Show the dispatcher one short path and the long Tuesday path. Which can be supported by more examples? Simplicity alone doesn't guarantee truth, but a branch based on one case deserves scrutiny.

04

Limits and next step

Next, we'll explain an individual prediction from the chosen tree without turning a decision path into a causal story.

Worked example

Choose depth on validation data, then compare train and validation errors.

Knowledge check

Quick check: test your understanding

Try it yourself: In the situation described above, explain the method and one reason its output might be misleading.

Check the reasoning

Pruning removes weak branches or limits tree growth to reduce overfitting. A smaller tree can underfit if it erases a genuine interaction.

What is the main idea behind prune a tree before it memorizes noise?

Pruning removes weak branches or limits tree growth to reduce overfitting.

How is it used in the example?

Choose depth on validation data, then compare train and validation errors.

What limitation should be checked?

A smaller tree can underfit if it erases a genuine interaction.

Further reading

Machine Learning — Tom M. Mitchell.

Original ToolsInVision teaching examples. Editorial approach · Suggest a correction

Accessible referenceLesson 27 transcript137 words · Video transcript · Matches the published narration and captionsOpen transcript

The tree now has a branch for one particular rainy Tuesday. It predicts every training trip perfectly, yet warnings on new days are poor. The branch may have learned an accident of the sample rather than a repeatable pattern.

Limit depth or minimum leaf size, or prune branches whose extra complexity does not improve validation performance. Choose these settings without touching the final test set. Compare train and validation errors as the tree grows. If training keeps improving while validation worsens, extra detail is hurting generalization.

Show the dispatcher one short path and the long Tuesday path. Which can be supported by more examples? Simplicity alone doesn't guarantee truth, but a branch based on one case deserves scrutiny.

Next, we'll explain an individual prediction from the chosen tree without turning a decision path into a causal story.