rasbt/machine-learning-book: What the Companion Code Repository Actually Contains
Code Repository for Machine Learning with PyTorch and Scikit-Learn
At a glance
- What is it?
- The repository holds the chapter notebooks for Machine Learning with PyTorch and Scikit-Learn, plus a conda environment and a Makefile. It is a companion to the book, not a standalone course, and the README says so plainly.
- Who is it for?
- Adopt it if you already own Machine Learning with PyTorch and Scikit-Learn and want the notebooks, environment.yml and Makefile that match the printed chapters. Do not adopt it as a self-contained machine learning course: the README states the notebooks may not be useful without the formulae and descriptive text.
- 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 107 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 September 17, 2026, and from our analysis. They are not legal advice.
Editorial analysis
What the rasbt/machine-learning-book Repository Is For
This is the code repository for Machine Learning with PyTorch and Scikit-Learn, published by Packt in 2022 and written by Sebastian Raschka, Yuxi (Hayden) Liu and Vahid Mirjalili. The repository is not a library you install and import. It is a set of chapter directories, ch01 through ch19, each holding the notebooks that accompany one chapter of the printed book. The primary language is Jupyter Notebook.
The README is direct about the scope: these are code examples uploaded for convenience, and the notebooks may not be useful without the formulae and descriptive text. That sentence should shape how you use the repository. The notebooks are the executable half of an explanation whose other half is on the page. Anyone arriving from a search for a free machine learning book should understand that this is not one; the book is sold through Packt and Amazon, and the repository is the appendix to it.
Who it suits: a reader working through the book who wants to run each chapter rather than read it, and an instructor who wants a chapter-by-chapter path from classical scikit-learn classifiers through PyTorch, transformers, GANs, graph neural networks and reinforcement learning.
How the Chapter Folders and Shared Tooling Fit Together
The layout is flat and predictable. Each chapter is a top-level directory, ch01 to ch19, and the README's table of contents links each one. The topics run in order: an introduction to machine learning, training classifiers, a tour of scikit-learn classifiers, data preprocessing, dimensionality reduction, model evaluation and hyperparameter optimization, ensemble learning, sentiment analysis, regression, clustering, a multi-layer neural network built from scratch, PyTorch training, the mechanics of PyTorch, convolutional networks, recurrent networks, transformers, generative adversarial networks, graph neural networks and reinforcement learning.
Around the chapter folders sit the shared pieces. environment.yml defines the conda environment. Makefile wraps the conda commands. python_environment_check.py is a script for checking the environment. .convert_notebook_to_script.py and update_python_from_notebook.sh convert notebooks to scripts and back, which is how the code can be maintained as plain Python. ERRATA/ collects corrections, and supplementary/ holds extra material, including a guide by Zbynek Bazanowski on running the code examples on Google Colab.
The data flow is manual rather than pipeline-driven. You activate the environment, open a notebook, and run cells top to bottom; each notebook carries its own data loading, either from scikit-learn's built-in datasets or from files the chapter expects. Nothing in the repository orchestrates the chapters as a single program, and there is no test suite described in the README.
Installing the Environment and Running a First Chapter
The README points to ch01/README.md for setup recommendations, and the Makefile encodes the conda commands. The install target appends the conda-forge channel and updates the existing pyml-book environment from environment.yml, with a comment noting it was used with conda 4.13.0.
make installIf the environment does not exist yet, the create target builds it. The Makefile comment explains why a separate target exists: the prune step broke after conda 4.4, so this path forces a fresh environment instead.
make createAfter either target completes, start Jupyter from the environment the Makefile defines; the environment name used in the Makefile is pyml-book. Chapter 2, in ch02, trains a perceptron on the Iris dataset, and its output is a decision boundary plot plus accuracy printed for each epoch. Keep the book open beside the notebook: the README's warning about missing formulae applies from the first chapter onward. If the environment misbehaves, python_environment_check.py is the repository's own check script, and ch01/README.md is where the project says to look first.
Where the Companion-Code Approach Breaks Down
The clearest limitation is stated by the project itself. The README warns that the notebooks may not be useful without the formulae and descriptive text. A reader who clones the repository expecting a self-contained tutorial will find code that references notation and derivations that live only in the book. That is a deliberate design choice, not an oversight, but it makes the repository a poor entry point for someone who has not bought the book.
The second constraint is the environment. The Makefile targets are written around conda, with a comment tying the install target to conda 4.13.0 and another explaining that prune broke after conda 4.4. Anyone on a different conda version, or on pip and venv, gets no supported path from the README; environment.yml is the file to translate by hand, and that is on you. The release history reinforces this: v1.0 and v1.1 both landed in early 2022, and the repository has not cut a release since, so the pinned dependencies reflect that period rather than current library versions.
The third is the format. Jupyter notebooks are the primary language here, which means git diffs are noisy and the code is harder to review than plain modules. The repository acknowledges this by shipping .convert_notebook_to_script.py and update_python_from_notebook.sh, but those are maintenance tools for the authors, not a workflow the README teaches. If you want a library you can depend on in production, this is the wrong repository; it teaches, it does not ship.
How It Differs from a Framework Documentation Set
The natural alternative is the official documentation and tutorials of the libraries themselves: the scikit-learn user guide and the PyTorch tutorials. Those are maintained against current releases, they are searchable, and they do not assume you have a 770-page book open. The difference in approach is sequencing. Library documentation is organized by API surface, so you learn what a class does and how to call it. This repository is organized by teaching order, so chapter 11 builds a multi-layer neural network from scratch before chapter 12 introduces PyTorch's training loop. That progression is the point: you see the mechanism before you use the abstraction.
A second alternative is a general notebook collection, such as the Colab guide that lives in supplementary/. That guide, contributed by Zbynek Bazanowski, explains how to run these same examples on Google Colab, which removes the conda setup entirely. The trade-off is environmental control: on Colab you inherit whatever library versions the runtime provides, and the pinned environment.yml no longer governs what you run.
Neither alternative reproduces the book's ordering with its explanatory text removed. If the ordering is what you want, the repository is the match; if current API coverage is what you want, the library docs are.
Maintenance, Licence and the Cost of Upgrading
The repository is not archived, and the last push was on 2026-06-15, so it is still receiving changes. That is worth separating from release cadence: the only releases listed are v1.0 from 2022-01-25 and v1.1 from 2022-02-25. The code moves; the versioned snapshots do not. For a reader, the practical consequence is that main may contain fixes that no release tag records, and ERRATA/ is the place the project collects corrections to the printed code.
Upgrade cost is dominated by the conda environment. environment.yml pins the dependency set, and the Makefile's install target prunes the environment to match it. When you move to newer library versions, you are updating that file and re-resolving, and the notebooks may need edits where APIs changed since the 2022 releases. Because the repository is a teaching artifact rather than a dependency, there is no compatibility promise to rely on; you verify by running the chapter you care about.
The licence is MIT, per the repository's LICENSE.txt. That is permissive: it allows reuse and modification with attribution, and it does not impose copyleft obligations. It covers the code in the repository. It does not cover the book's text, which remains with Packt, so do not read the MIT grant as permission to redistribute the prose. This is a description of the licence, not legal advice; check the terms yourself if you plan to republish anything.
Editorial conclusion
Adopt it if you already own Machine Learning with PyTorch and Scikit-Learn and want the notebooks, environment.yml and Makefile that match the printed chapters. Do not adopt it as a self-contained machine learning course: the README states the notebooks may not be useful without the formulae and descriptive text. Before you start, open ch01/README.md for the setup recommendations, confirm your conda version behaves with the install target, and check ERRATA/ for corrections to the code you are about to run.
Frequently asked questions
Can I use the rasbt/machine-learning-book notebooks without buying the book?
The README states that these are just the code examples accompanying the book and that the notebooks may not be useful without the formulae and descriptive text. The code runs, but the explanations live in the printed book.
How do I install the environment for rasbt/machine-learning-book?
The Makefile provides a create target that runs conda env create environment.yml --force, and an install target that appends conda-forge and updates the pyml-book environment from environment.yml. The README points to ch01/README.md for setup recommendations.
What is the rasbt/machine-learning-book repository?
It is the code repository for the book Machine Learning with PyTorch and Scikit-Learn by Raschka, Liu and Mirjalili, published by Packt in 2022. It holds chapter directories ch01 through ch19 with the accompanying Jupyter notebooks.
Does the repository provide a PDF of the book?
No. The README links to the Amazon and Packt pages for the book and describes the repository as the code examples accompanying it. The MIT licence in the repository covers the code, and the README does not offer the text as a download.
What is the best book for learning machine learning?
The repository does not rank books. It is the companion code for Machine Learning with PyTorch and Scikit-Learn, which the README describes as 770 pages, published by Packt, with the chapter notebooks in ch01 through ch19.
Official sources
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.
[](https://hysenlabs.com/projects/rasbt-machine-learning-book)