Module 11: Tree-Based Models and Feature Importance

Linear models assume a straight-line world. This module introduces a different way of thinking: models that split data into groups by asking a sequence of yes/no questions. You will start with a single decision tree, which is easy to read but prone to overfitting, then see how random forests combine hundreds of trees into something far more accurate. The module closes on interpretability — once a model is an ensemble of hundreds of trees, how do you explain what it learned?

Learning Objectives

By the end of this module, you will:

  • Explain how decision trees predict through recursive splitting
  • Build classification and regression trees with scikit-learn and control their complexity
  • Explain how bagging and feature randomness make a forest better than its trees
  • Build random forest models and tune their key hyperparameters
  • Articulate the accuracy–interpretability trade-off and why it matters
  • Distinguish model-based (impurity) from model-agnostic (permutation) feature importance
  • Create and interpret partial dependence plots to see how a feature drives predictions
  • Recognize pitfalls including high-cardinality bias, correlated features, and the causation fallacy

Module Resources

Lecture

Resource Link
📊 Week 11 Slides View slides

Chapters & Notebooks

Each chapter has a companion Colab notebook with all the code from the chapter — ready to run, no installation required.

Chapter Topic Colab Notebook
25 Decision Trees Open in Colab
26 Random Forests Open in Colab
27 Understanding Feature Importance Open in Colab

Lab

Resource Link
🧪 Lab 11: Tree-Based Models Open in Colab

Reference

Resource Link
📋 Module 11 Cheat Sheet View cheat sheet