Open-source project
rasbt/machine-learning-book avatar
rasbt/machine-learning-book

Nineteen chapter folders, one Makefile, and setup instructions kept in ch01

Code Repository for Machine Learning with PyTorch and Scikit-Learn

5,475 stars1,870 forksJupyter NotebookMIT

At a glance

What is it?
This is the notebook code that ships with a 770 page Packt textbook, not a course of its own. Setup lives one folder down in ch01/README.md, the only scripted path is a conda Makefile with two targets written against different conda versions, and the project tells you plainly that the notebooks do not stand without the book text.
Who is it for?
Treat this repository as companion code for a book you own or plan to buy, not as a standalone course. It works for readers who have the printed formulae in front of them and want runnable scikit-learn and PyTorch examples.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 153 days ago.
What is it written in?
Mainly Jupyter Notebook, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 13, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • rasbt/machine-learning-book5,475 ★ · +94
Star history
Repository2026-09-132026-11-13
rasbt/machine-learning-book5.4k5.5k

94 Stars in the last 61 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Setup instructions live one folder down, in ch01/README.md

Getting this code to run starts one level below the root. The root README sends you to ch01/README.md twice, once for helpful installation and setup instructions and once for setup recommendations for the coding environment. At the root, the only scripted route is the Makefile, and its install target appends the conda-forge channel, then updates an environment named pyml-book from environment.yml and prunes whatever the file no longer lists. Two comments pin the conda behaviour the commands were written for.

make
install:
	# Used with conda 4.13.0
	conda config --append channels conda-forge
	conda env update -n pyml-book --file environment.yml --prune
create:
	# Required to remove old dependencies due to broken prune after conda 4.4
	# https://github.com/conda/conda/issues/7279
	conda env create environment.yml --force

A reader who never opens the Makefile never learns the environment name, because no prose at the root spells out pyml-book. The file python_environment_check.py sits beside it for verifying an interpreter after setup.

Two Makefile targets exist because conda pruning broke twice

The two targets are not interchangeable, and the difference is not cosmetic. The install target updates an environment that already exists under the name pyml-book, which means the name is fixed on the command line with -n. The create target passes environment.yml as a positional argument, passes no -n at all, and adds --force. Its comment blames broken prune behaviour after conda 4.4 and links the conda tracker issue directly. In other words, the comment says create is required to remove old dependencies because prune is broken after conda 4.4. The README's Makefile is historical: current conda documents the environment file with `-f environment.yml`, and `--force` can remove an existing environment with the same name. Check the current conda documentation and back up or use a separate environment before recreating it.

Chapter 1 through chapter 19, with the argument left out of the folders

Nineteen folders carry the code, one per chapter, and the order matters. Chapter 1 orients a reader to learning from data, chapter 2 trains classification algorithms, chapter 3 tours scikit-learn classifiers, chapter 4 builds training sets through data pre-processing, chapter 5 compresses data by dimensionality reduction, chapter 6 covers model evaluation and hyperparameter optimization, and chapter 7 combines models in ensembles. Later folders move to applied text work, regression, clustering, a multi-layer network built from scratch in chapter 11, parallelized training in chapter 12, PyTorch mechanics in chapter 13, convolutional networks for images, recurrent networks for sequential data, transformers and attention, generative adversarial networks, graph neural networks, and reinforcement learning in chapter 19. The connective argument for all of it is the 770 page paperback from Packt, not the repository.

The root layout says notebooks are the source and scripts are derived

The top level is small enough to read in one screen, and it says what kind of repository this is.

text
.convert_notebook_to_script.py
.gitignore
.other/
ERRATA/
LICENSE.txt
Makefile
README.md
ch01/
ch02/
ch03/
ch04/
ch05/
ch06/
ch07/
ch08/
ch09/
ch10/
ch11/
ch12/
ch13/
ch14/
ch15/
ch16/
ch17/
ch18/
ch19/
environment.yml
python_environment_check.py
supplementary/
update_python_from_notebook.sh

Two of those entries exist purely to extract plain Python from notebooks, so notebooks are the source of truth. environment.yml is the single dependency manifest, and LICENSE.txt carries an MIT grant. Nothing in that listing is a test directory and nothing is a continuous integration workflow, which is the first hard limit on what you can expect the project to catch for you.

Colab instructions arrive as a contributed PDF, not as a setup script

Zbynek Bazanowski contributed a guide at supplementary/running-on-colab.pdf that explains how to run the code examples on Colab, the hosted notebook service. That document is the only route the project offers for readers who do not want a local conda environment, and it is a PDF rather than a script, so nothing in the repository provisions a runtime for you. The root README also warns readers in plain words that these are code examples accompanying the book, uploaded for convenience, and that the notebooks may not be useful without the formulae and descriptive text. Those two statements describe the same constraint from opposite ends. The consequence for a reader is that cloning this repository does not hand you a course with lessons. It hands you cells written for someone reading the printed chapter, and on Colab it hands you a PDF to read before the first cell runs.

ERRATA at the root, two tags from 2022, and commits that continue past them

Two facts about time sit next to each other here. The published tags are v1.0 on 25 January 2022 and v1.1 on 25 February 2022, which lines up with a Packt book from 2022 and a 770 page paperback carrying ISBN-10 1801819319 and ISBN-13 978-1801819312. The most recent push to the default branch main is dated 15 June 2026. Corrections live in the ERRATA directory at the root rather than inside the chapter folders. A reader comparing notebook output against a printed page therefore has two moving references: a tagged 2022 edition and later commits on main that postdate both tags. Check which commit you hold before you treat a mismatch as a bug in the example itself.

No tests, no pip manifest, and library APIs that moved since 2022

The two absences that matter most are visible in the root listing. There is no test directory and no workflow configuration, so nothing re-runs the notebooks when a library version shifts under them. The only dependency manifest is environment.yml, and it is consumed by the two conda targets in the Makefile, with no requirements.txt for readers who prefer pip. Add the 2022 tags to that and a concrete risk appears: an exercise in chapter 9 or chapter 16 can stop running because the library call it makes has changed, and the repository contains nothing that would tell you. So verify the API each notebook calls against the version you actually installed, read the ERRATA directory as part of the code rather than an afterthought, and expect to do the debugging that a test suite would otherwise do for you.

Editorial conclusion

Treat this repository as companion code for a book you own or plan to buy, not as a standalone course. It works for readers who have the printed formulae in front of them and want runnable scikit-learn and PyTorch examples. It does not work for anyone expecting per-chapter explanations or tests inside the repository. Before you commit, confirm ch01/README.md still matches your conda version, read the ERRATA directory for the chapters you plan to run, and remember that both tags stopped in 2022 while commits continue on main.

Frequently asked questions

What is the best book for learning machine learning, and does rasbt/machine-learning-book cover the range?

This repository is the notebook code for Machine Learning with PyTorch and Scikit-Learn, a 770 page paperback from Packt Publishing. Its 19 chapters run from a tour of scikit-learn classifiers and data pre-processing through transformers, graph neural networks and reinforcement learning. Which title suits you best is a reading decision the repository does not settle.

Can I learn ML on my own with rasbt/machine-learning-book?

Only with the book beside you. The root README warns that the notebooks may not be useful without the formulae and descriptive text, and setup instructions live in ch01/README.md rather than in each chapter folder. For running the examples without a local conda environment, the project points to a contributed Colab guide at supplementary/running-on-colab.pdf.

what is machine learning book pdf, does rasbt/machine-learning-book ship one?

The repository holds notebooks, not a copy of the book. The paperback runs to 770 pages, ISBN-10 1801819319, ISBN-13 978-1801819312, with Kindle ASIN B09NW48MR1, published by Packt in 2022. A Serbian translation is listed with ISBN 9788673105772.

how to learn machine learning book, where does rasbt/machine-learning-book start?

Chapter 1 is the orientation chapter and holds the setup instructions at ch01/README.md. Chapter 2 trains classification algorithms, chapter 3 tours scikit-learn classifiers, chapter 4 handles data pre-processing, and the coded path continues through chapter 19 on reinforcement learning.

Official sources

  1. License: MIT
  2. Project website
  3. rasbt/machine-learning-book on GitHub
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/rasbt-machine-learning-book.svg)](https://hysenlabs.com/projects/rasbt-machine-learning-book)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/rasbt-machine-learning-book.svg)](https://hysenlabs.com/projects/rasbt-machine-learning-book)

Was this useful?