handson-ml2: Hands-On ML with Scikit-Learn & TensorFlow
The Handson ML2 notebooks are worth opening only if you want the second-edition code for Aurélien Géron's book. Starting fresh? Use handson-ml3 or handson-mlp instead — the repo's own description says so. The teaching itself hasn't aged: still a clear, line-by-line scikit-learn walkthrough plus a Keras/TensorFlow 2 introduction. The setup has aged — Python 3.8 and that conda environment.yml were current for 2019, not now.
What is handson-ml2?
The Handson ML2 notebooks are the official Jupyter code and exercise solutions for the second edition of Aurélien Géron's 2019 O'Reilly book on Scikit-Learn, Keras, and TensorFlow. Every chapter's code and solved exercises run in Colab, Kaggle, Docker, or a local conda setup. The GitHub description flags the project deprecated, pointing to handson-ml3 or handson-mlp.
What the notebooks cover
- ✓Exercise solutions for the book's chapters, not just example code, so the notebooks double as a worked answer key.
- ✓A scikit-learn track for classical supervised learning — classification and regression built on scikit-learn's estimator API.
- ✓A Keras/TensorFlow 2 track that moves from a first neural network into deep learning examples, covering model training end to end.
- ✓An end-to-end housing-data project — the README's FAQ even has a dedicated entry for its fetch_housing_data() and load_housing_data() helper functions.
- ✓A separate docker/ directory with its own setup instructions, maintained apart from the conda environment.yml path.
- ✓Pointers to run notebooks without installing anything, via services like Colab or Kaggle, plus a plain GitHub notebook viewer for skimming without executing code.
Who this book is for
- •Python developers who want the classic scikit-learn workflow explained next to runnable code, not a slide deck.
- •Readers working through the printed second-edition book who want matching notebooks instead of retyping code from the page.
- •Self-learners deciding whether to buy the current edition, who want to see exactly what a 2019 conda setup looks like before switching.
- •Instructors running a course still built around the second edition, who need these exact notebooks rather than the third edition's rewritten code.
Strengths
- ✓Exercise solutions are included alongside the example code, which most book-companion repos skip.
- ✓Covers both a classical scikit-learn track and a Keras/TensorFlow 2 deep-learning track in one place.
- ✓Several ways to run it — Colab or Kaggle in the browser, a Docker image, or a local conda environment — so you're not locked into one setup.
- ✓The FAQ answers real errors people hit, like the load_housing_data() ordering issue and the MacOSX SSL error, not just the installation happy path.
Why this edition is outdated
- △The repo is explicitly deprecated: the GitHub description and the top of the README both point to handson-ml3 and a newer PyTorch edition, handson-mlp, as the current versions.
- △The recommended Python 3.8 and the conda environment.yml date the setup to 2019; the README's own FAQ says some libraries didn't yet support Python 3.9 or 3.10.
- △The notebook services it recommends for running code without installing anything are temporary — the README warns that anything you don't download gets deleted after the session ends.
- △A few FAQ fixes are narrow and dated, like the MacOSX SSL certificate fix tied to a specific python.org install path; deeper update instructions just point out to a separate INSTALL.md file.
Current editions and alternatives
Frequently asked questions
The Handson ML2 notebooks cover the second edition of the book, which the repo's own README calls outdated, pointing readers to handson-ml3 and a newer PyTorch edition, handson-mlp. The code and exercises here still run and still teach the same scikit-learn and Keras/TensorFlow basics, so it's fine if you're reading the second-edition print book, but a new reader should start with handson-ml3.
The Handson ML2 README recommends Python 3.8. Following the documented conda setup, which creates a tf2 environment from environment.yml, gives you Python 3.8 by default. The README notes most of the code works on other Python 3 versions too, but some pinned libraries didn't yet support Python 3.9 or 3.10, which is why 3.8 stays the recommendation.
The Handson ML2 notebooks can run on Google Colab at no cost — the README recommends Colab, alongside Kaggle, specifically because both offer free GPU and TPU access. It also warns these are temporary environments: anything you don't download gets deleted after the session ends, so save your work before closing the tab.
The second edition tracks supervised learning tasks like classification and regression with scikit-learn, then neural networks and deep learning built with Keras and TensorFlow 2, with end-to-end ML projects and exercise solutions for each chapter.
The Handson ML2 README's FAQ covers this directly: install the SSL certificates for your Python install. If you got Python from the official python.org installer, run the bundled Install Certificates.command script in a terminal, matching your Python version. If you installed Python via MacPorts instead, run sudo port install curl-ca-bundle.
The Handson ML2 notebooks are written for TensorFlow 2 — the documented conda setup activates an environment literally named tf2, and the deep-learning chapters use the Keras API that ships with TensorFlow 2.x rather than older TensorFlow 1 syntax.
Who should try it — and who should skip
Try handson-ml2 if you already own or are working through the printed second-edition book and want the matching runnable notebooks — the FAQ section alone, with the housing-data helper functions and the MacOSX SSL fix, will save real debugging time. Skip it if you're starting from zero: the repo tells you outright to go to handson-ml3 or handson-mlp, and there's no reason to fight a 2019 conda environment when a maintained edition exists.
Is handson-ml2 worth your time?
ChatGPT, Claude and Perplexity can all read this page. Ask one of them what it makes of handson-ml2.
