Topic 6d – Decision Trees

An AI that shows its work — every question it asks, every branch it follows, every conclusion it reaches.

Learning Objectives

By the end of this topic, you should be able to:

Learning Activities

To help you meet the learning objectives, we have prepared a combination of readings, activities, and videos.

Course Readings

These reading were designed to introduce the course topics to an audience of educators. They should be considered "required" and read in order.

Supplemental Readings

Some participants find it helpful to read about a topic from a source written for a slightly more technical audience. These supplemental readings cover similar material as the course readings but may not fully align with the course learning objectives. Use them as an optional complement to your study, not a substitute for the course readings.

Lesson Videos and Activity

When this course has a face-to-face component I conduct a hands-on, unplugged activity that gives participants an opportunity to explore the concept of building a decision tree. While you do not have an opportunity to complete this activity with your peers, I think it is worth trying to replicate that process instead of giving you a traditional "lecture."

Please work through the materials below in the order that they are listed.

 

Checking for Understanding, Questions

Reading and Tracing Trees

  1. Consider a simple decision tree for recommending whether a student should attend after-school tutoring:
    • Root split: Is the student's current grade below 70%?
    • If Yes → Is the student currently missing more than two assignments?
      • If Yes → Recommend tutoring
      • If No → Schedule a check-in conversation
    • If No → No action needed
    Trace this tree for a student with a 65% grade and all assignments submitted. What recommendation does the tree produce? Does it seem reasonable?
  2. What is the difference between an internal node and a leaf node in a decision tree? What kind of information does each one represent?
  3. A decision tree produces a classification for every input, even inputs that look nothing like anything in its training data. Is that a strength or a weakness? Explain your reasoning.

Building Trees and Overfitting

  1. A loan officer is building a decision tree to classify loan applications as approve or deny. The available attributes are: credit score, annual income, existing debt, employment status, loan amount, and loan purpose (car, home, personal). Which attribute would you expect to produce the best first split, and why? Which attribute would you expect to produce the worst first split?
  2. A teacher builds a decision tree from three years of student data to predict which students will struggle on the final exam. The tree perfectly classifies every student in those three years. When applied to this year's students, it performs no better than a coin flip. What is the most likely explanation? What does this tell us about what "learning" means for an AI system?
  3. In your own words, explain why a simpler decision tree often generalizes better to new data than a very complex one. How is this similar to the way a good teacher writes a test — testing understanding rather than memorized facts?

Real-World Connections

  1. Credit scoring, medical diagnosis support, spam filtering, and student early warning systems all use decision trees or related structures. Pick one of these and describe what it is classifying, what attributes it likely uses to split, and what the leaf node outcomes represent.
  2. Decision trees are an example of supervised learning. In one or two sentences, explain what "supervised" means in this context — what role do the labeled training examples play in producing the tree?

Checking for Understanding, Answers

You can compare your answers to the following answer key.

Show Answer Key

Reading and Tracing Trees

  1. Trace: Grade = 65% → Is grade below 70%? Yes → Is the student missing more than two assignments? No (all assignments submitted) → Schedule a check-in conversation. This seems reasonable: the student is struggling academically (below 70%) but is staying on top of their work, which suggests something other than disengagement may be affecting their grade — a conversation seems more appropriate than immediately prescribing tutoring.
  2. An internal node is a decision point — it represents a question or test applied to one attribute of the input (e.g., "Is grade below 70%?"). It has branches leading to other nodes. A leaf node is a terminal point — it represents the final classification or decision output (e.g., "Recommend tutoring"). When a path through the tree reaches a leaf, the classification is complete; no more questions are asked.
  3. Both, depending on context. It is a strength in that the tree is always usable — it does not crash or refuse to classify when it sees an unusual input. It is a weakness in that the classification for very unusual inputs may be unreliable, since the tree extrapolates from patterns in its training data that may not apply. The concern is particularly acute for high-stakes decisions — a tree that confidently classifies inputs far outside its training distribution may be wrong in ways that are hard to detect.

Building Trees and Overfitting

  1. Best first split: credit score. A good split separates the data into groups that are as pure as possible (mostly approve or mostly deny). Credit score is designed specifically to summarize creditworthiness and is likely to strongly predict loan approval — it should produce two groups (high score / low score) that differ substantially in approval rates. Worst first split: loan purpose (car, home, personal). With only three values and no inherent ordering, this attribute is unlikely to strongly predict approval on its own — good and bad applicants exist in all three categories.
  2. The most likely explanation is overfitting: the tree grew so complex that it memorized specific details about the three years of training data rather than learning general patterns. Every quirk, noise, and coincidence in those three years got encoded as a rule. When applied to new students, those memorized specifics do not generalize — the tree predicts based on patterns that were artifacts of the training data, not real predictors of exam struggle. This illustrates that a model that "learns" too precisely from training data may not have learned anything meaningful at all.
  3. A simpler tree has fewer splits and captures broader, more general patterns in the data. A complex tree captures every detail of the training set, including noise and coincidence, which do not generalize. Similarly, a test that probes deep understanding can be answered correctly by students who genuinely grasp the material — even if they encounter new problem types. A test that only asks for memorized specifics can be "passed" by students who studied the exact examples, but who fail when faced with even slightly different problems. Both the tree and the test are only as good as their ability to measure the underlying concept, not surface-level pattern matching.

Real-World Connections

  1. Many valid answers. Example for spam filtering: classifying each incoming email as spam or not spam. Attributes used to split might include: presence of specific keywords ("free", "winner", "urgent"), sender address (known or unknown domain), number of links, whether the recipient is in the To or Bcc field, and message length. Leaf node outcomes are: move to spam folder or deliver to inbox.
  2. "Supervised" means the training examples come with correct labels — each example has already been classified by a human or some trusted source. The labeled examples are the supervisor: the tree-building algorithm learns which attributes and splits produce correct classifications by repeatedly checking its decisions against those known labels. Without labels, there is no feedback signal to guide which splits are better or worse.

Extend Your Learning

The following resources go a little deeper on topics we touched on but did not fully explore in the readings. These are entirely optional — none of this material appears on the Competency Demo — but each one is a natural "next question" from something covered this week.

  • Random forests: many trees, better decisions
    A random forest builds many decision trees on random subsets of the training data and combines their votes. The result is dramatically more accurate and less prone to overfitting than any single tree — at the cost of being much harder to interpret. This accessible article from Towards Data Science covers how random forests work and why they outperform individual trees.
    Understanding Random Forest — Towards Data Science
  • Information gain and entropy
    The mathematical framework behind choosing the best split — measuring how much a question reduces uncertainty. These concepts come from information theory and underpin the ID3 and C4.5 algorithms that build decision trees automatically. This article by Victor Zhou introduces entropy in an accessible way.
    Measuring Information — Victor Zhou
  • Explainable AI: why interpretability matters
    Decision trees are one of the few AI models that can explain their own reasoning in plain language. The emerging field of Explainable AI (XAI) asks how to give other, more powerful models the same property — a challenge that turns out to be surprisingly hard. This DARPA overview explains why the government cares about explainability and what the field is trying to achieve.
    Explainable Artificial Intelligence — DARPA