Lab notebooks

Fifteen notebooks, one per chapter, each living beside the deck it accompanies in Chapters/chapter_NN/chapter_NN_lab.ipynb. They come in two kinds.

Twelve taught labs — one per lecture deck, both precourse sessions included. Each mirrors its chapter’s Python lab and closes with worked solutions to that chapter’s exercises. These are the labs the course is built around.

Three code references — chapters 9, 11 and 12 have a notebook but no lecture deck and no worked solutions. They show how to run the methods in Python; the ISLP chapter does the teaching. Read the chapter first.

Each notebook runs locally or on Google Colab; data loads via the ISLP package with an automatic fallback to the bundled CSVs, so nothing needs downloading by hand. Colab is the recommended route — nothing to install.

Every notebook is rendered in full below (with its stored outputs — the documentation build never executes them).

12 taught labs (with solutions) 3 code references (no deck, no solutions) runs locally and on Colab

Lecture chapters — the twelve taught labs

Ch.

Lab

Read here

Open in Colab

0 · Precourse (a) — Statistics

chapter_00_lab.ipynb

Rendered

Colab

0b · Precourse (b) — Toolkit

chapter_00b_lab.ipynb

Rendered

Colab

1 · Introduction

chapter_01_lab.ipynb

Rendered

Colab

2 · Statistical Learning

chapter_02_lab.ipynb

Rendered

Colab

3 · Linear Regression

chapter_03_lab.ipynb

Rendered

Colab

4 · Classification

chapter_04_lab.ipynb

Rendered

Colab

5 · Resampling Methods

chapter_05_lab.ipynb

Rendered

Colab

6 · Model Selection & Regularization

chapter_06_lab.ipynb

Rendered

Colab

7 · Moving Beyond Linearity

chapter_07_lab.ipynb

Rendered

Colab

8 · Tree-Based Methods

chapter_08_lab.ipynb

Rendered

Colab

10 · Deep Learning

chapter_10_lab.ipynb

Rendered

Colab

13 · Multiple Testing

chapter_13_lab.ipynb

Rendered

Colab

Untaught chapters — three code references

These three ISLP chapters are outside the twelve-lecture plan. There is no deck for them, and the notebooks ship without worked solutions: the exercises at the end are left unanswered on purpose. Treat each as a code reference to read alongside its ISLP chapter, not as a lab equivalent to the twelve above.

Ch.

Code reference

Read here

Open in Colab

9 · Support Vector Machines

chapter_09_lab.ipynb

Rendered

Colab

11 · Survival Analysis

chapter_11_lab.ipynb

Rendered

Colab

12 · Unsupervised Learning

chapter_12_lab.ipynb

Rendered

Colab

Tip

The Colab badges open straight from the public GitHub repository; a Google account is all you need to run a notebook.

How the notebooks find their data

Each notebook opens with a setup cell that:

  1. detects whether it is running on Colab and installs any missing packages (ISLP, plus pygam / xgboost / lifelines for the chapters that need them — torch is preinstalled on Colab);

  2. loads each dataset from the ISLP package where possible, streams the four it does not ship (Advertising, Heart, Income1, Income2) from the book’s official site, and falls back to the bundled ALL CSV FILES - 2nd Edition/ folder otherwise.

So a fresh Colab runtime works with no manual downloads, and a local checkout works offline.

All notebooks

Where to go next

  • Lecture slides — the deck each taught lab accompanies.

  • For students — how the labs relate to the lectures, and what to do when your numbers differ.

  • Datasets — what is bundled, and which chapter uses it.

  • Python environment — the pinned packages, and the four chapter-specific ones.