# rasbt/python-machine-learning-book: what the 1st edition code repository actually contains

> This is the companion code repository for the 1st edition of Python Machine Learning by Sebastian Raschka, not a library. It holds 13 chapter notebooks and points readers to the 2nd edition repository for newer code.

**rasbt/python-machine-learning-book** — The "Python Machine Learning (1st edition)"  book code repository and info resource

- Repository: https://github.com/rasbt/python-machine-learning-book
- Stars: 12,652 · Forks: 4,362
- Language: Jupyter Notebook
- License: MIT
- Published: 2026-09-10 · Updated: 2026-09-10 · Language: en
- Canonical page: https://hysenlabs.com/projects/rasbt-python-machine-learning-book

## What the 1st edition repository is, and who it is for

The README opens with a note dated 09/21/2017: this GitHub repository contains the code examples of the 1st Edition of Python Machine Learning, and readers looking for the 2nd Edition are pointed to a separate repository. That sentence sets the boundary of the project. It is a companion to a 454-page Packt book published on September 23rd 2015, and the code exists to be read next to the chapters rather than imported as a dependency. The README is explicit about this: the notebooks "may not be useful without the formulae and descriptive text."

The audience is narrow and identifiable. You are either working through the 1st edition and want to execute the examples, or you are teaching from it. The repository also links slides shared by Dmitriy Dligach from a machine learning course at Loyola University Chicago, which suggests classroom use is part of the intended readership. If you want a maintained library that you call from your own code, this is the wrong shape of project entirely: there is no package to install, no API surface, and no versioned interface beyond the book's chapters.

## Thirteen chapter notebooks and how the code is laid out

The repository root holds code/, docs/, faq/ and images/ alongside LICENSE.txt and README.md. Inside code/ there are thirteen chapter directories, ch01 through ch13, each containing an .ipynb notebook. The README lists every chapter with three links: the directory, the raw notebook, and an nbviewer URL for rendering on GitHub's viewer. The chapter titles map the book's progression from an introduction to machine learning, through classification with scikit-learn, data preprocessing, dimensionality reduction, model evaluation and hyperparameter optimization, ensemble methods, sentiment analysis, embedding a model in a web application, regression, clustering, neural networks for image recognition, and finally parallelizing neural network training via Theano.

The stated tool stack is NumPy, scikit-learn and Theano. Chapter 3 is described as a tour of classifiers using scikit-learn, chapter 12 covers training artificial neural networks for image recognition, and chapter 13 is where Theano appears. The docs/ directory carries an equation reference in PDF and TeX form, plus the foreword and preface excerpts as PDFs. The README also links two free background chapters on algebra basics and a calculus and differentiation primer, hosted on the author's site, which the README says were omitted from the book because of length limits.

## Setting up Python and opening a chapter notebook

The repository does not document an install command of its own. The README points to code/ch01/README.md for "Instructions for setting up Python and the Jupiter Notebook", and that file is where the environment steps live. The notebooks are Jupyter Notebook files, so the practical path is to follow that chapter 1 setup document and then open the notebook you need.

The README gives the notebook entry points directly. Each chapter is listed with a directory link, an ipynb link, and an nbviewer link, for example:

```bash
./code/ch03/ch03.ipynb
```

Opening that file in Jupyter shows the scikit-learn classifier tour for chapter 3. If you would rather not run anything locally, the nbviewer link next to each chapter renders the same notebook in a browser, which is enough to follow the plots and printed results while reading. The README notes that the internal document links are only supported by the nbviewer version, so use the nbviewer URL when you want to jump between sections inside a chapter.

Chapter 13 is the exception to any simple setup story. It covers parallelizing neural network training via Theano, and Theano is named in the README as part of the book's tool stack alongside NumPy and scikit-learn. The chapter 1 instructions are the only setup document the README points to, so treat the Theano chapter as its own environment problem.

## The 2nd edition redirect and the Theano dependency

Two limitations matter more than anything else here. The first is the README's own note: the 2nd edition of the book has its own repository, and the 1st edition code is frozen at what shipped with the original text. The most recent release listed is v1.3 from 2016-09-30, following v1.2 in March 2016 and v1.0 in October 2015. Anyone arriving today and expecting current scikit-learn idioms will find the notebooks written against the APIs of that period. The last push to the repository was on 2026-07-18, which keeps it from being an abandoned archive, but the release history shows the content itself has not been reissued since 2016.

The second is Theano. Chapter 13 is built around parallelizing neural network training via Theano, and Theano is a project that readers of the era installed separately. The README's setup pointer sends you to the chapter 1 instructions, and the tool stack named in the README is NumPy, scikit-learn and Theano. If your goal is to learn neural network training on current tooling, the 1st edition's final chapters are the weakest reason to be here. The clustering, preprocessing, model evaluation and ensemble chapters age better because they lean on scikit-learn primitives that have kept their shape.

## How it compares with the 2nd edition repository

The honest alternative is the one the README names: the python-machine-learning-book-2nd-edition repository. The difference is not a fork or a patch level. According to the README note, the 2nd edition repository is where readers should go if they want the code examples for the 2nd edition, and the linked page describes what changed from the first edition. That makes the choice a matter of which book you hold. If your copy is the 1st edition, the chapter numbering and the prose references in this repository will line up with your pages; the 2nd edition notebooks will not, because the chapters were reorganized.

Choosing this repository when you own the 2nd edition book produces a mismatch you will notice immediately: the README's chapter list here runs from an introduction through Theano, and the 2nd edition's structure differs. Choosing the 2nd edition repository when you own the 1st edition book creates the reverse problem. Neither repository is a general-purpose machine learning toolkit, so comparing them to a library like scikit-learn misses the point: both are book companions, and the correct one is determined by the ISBN on your desk.

## Licence, reuse and what upgrades cost you

The repository is MIT licensed, with LICENSE.txt at the root. For code reuse that is permissive: you can copy notebook cells into your own work under the terms of that licence. The MIT licence covers the code in the repository, not the book text, the figures, or the PDFs under docs/, which come from a commercial Packt publication. Do not read the MIT file as permission to redistribute the book's prose or its equation reference PDF; those are separate works and the repository does not address them. This is not legal advice, and if you plan to republish substantial portions, the licence file alone will not answer the question.

Upgrade cost is low in the sense that nothing here updates and nothing breaks your build, because it is not a dependency. It is high in the sense that moving the notebooks to current library versions is work you do yourself: scikit-learn's API has changed since 2016, and Theano is not part of the setup described in code/ch01/README.md. The repository gives you no migration guide and no compatibility matrix. The FAQ directory exists at the root, and the README links to a Google Group for the reader discussion board, which is the only support channel named in the README.

## Conclusion

Adopt this repository if you already own or are reading the 1st edition and want the notebooks to run alongside the text, or if you want a scikit-learn, NumPy and Theano walkthrough that predates the 2nd edition rewrite. Do not adopt it as a starting point for new machine learning work, because the README itself redirects readers to the 2nd edition repository and the last release, v1.3, dates from 2016-09-30. Verify first that your installed scikit-learn and Theano versions still match what the notebooks import, and check code/ch01/README.md for the environment setup the author documents.

## FAQ

### What is the best book to learn machine learning using Python?

This repository cannot answer that, because it only covers one book: the 1st edition of Python Machine Learning by Sebastian Raschka, published by Packt in September 2015. The README does point readers to the 2nd edition repository and to free background chapters on algebra and calculus, which is the closest thing to a recommendation in the README.

### Is machine learning with Python easy?

The README does not make a difficulty claim either way. It describes the book as 400 pages covering theory through to code, and warns that the notebooks may not be useful without the formulae and descriptive text, which suggests the code alone is not a shortcut.

### Can I learn ML in 3 months?

Nothing in the repository addresses study timelines. The only structural hint is the chapter sequence from ch01 through ch13, spanning classification, preprocessing, dimensionality reduction, evaluation, ensembles, sentiment analysis, regression, clustering and neural networks.

### Can Python be self-taught?

The repository does not discuss learning Python itself. Its setup instructions live in code/ch01/README.md, which the README links as the place to set up Python and the Jupyter Notebook before running any chapter.

## Sources

- [Issues](https://github.com/rasbt/python-machine-learning-book/issues)
- [License: MIT](https://github.com/rasbt/python-machine-learning-book/blob/master/LICENSE)
- [rasbt/python-machine-learning-book on GitHub](https://github.com/rasbt/python-machine-learning-book)
- [README](https://github.com/rasbt/python-machine-learning-book/blob/master/README.md)
- [Releases](https://github.com/rasbt/python-machine-learning-book/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/rasbt-python-machine-learning-book
