Module 3: Decision Trees (The Flowchart)
📚 Module 3: Decision Trees
Course ID: ML-303
Subject: The Logical Flowchart
If you have ever played the game 20 Questions, you already understand Decision Trees. They are one of the most intuitive ways for an AI to make a decision.
🌳 Step 1: The Structure (The “Flowchart”)
A Decision Tree is just a series of questions.
- Root: The first question at the top.
- Leaf: The final answer at the bottom.
🧩 The Analogy: Should I go outside?
- Is it raining? (Root)
- Yes: Stay inside. (Leaf)
- No: Is it cold?
- Yes: Wear a jacket. (Leaf)
🏗️ Step 2: Information Gain (The “Smart Question”)
How does the AI know which question to ask first? It wants to ask the Smartest question first—the one that splits the data into the cleanest groups.
🍎 The Analogy: Sorting Fruit
Imagine you have a basket of Apples and Bananas.
- Question: “Is it red?” (Smart! All apples are red).
🥅 Module 3 Review
- Goal: Build a logical flowchart to reach a decision.
- Nodes: The “Questions” and “Answers” in the tree.
- Gini Impurity: A measure of how messy a group of data is.
- Overfitting: When the tree grows too big and memorizes noise.
:::tip Slow Learner Note Decision Trees are powerful because they work for both numbers and categories. But they can be unstable—to fix that, we use a Random Forest. :::