Back to index
OtherAround 770 pages across 19 chapters, two to three months at a steady pace·Around $50 in print, cheaper as an ebook, code free on GitHub

Machine Learning with PyTorch and Scikit-Learn (Raschka, Liu and Mirjalili)

4.5

The most complete single volume bridge from classical machine learning to deep learning that I know of. It is not elegant, but it is thorough and the code always works.

What We Liked

  • Covers classical ML and deep learning properly rather than treating one as a preamble
  • Implements algorithms from scratch first, then shows the library version, which is the right order
  • The GitHub repository is maintained and every chapter runs
  • Raschka explains without either hand waving or drowning you in notation
  • Genuinely good coverage of the boring essentials like preprocessing and model evaluation

What Could Be Better

  • Published in early 2022, so the transformer and generative chapters are noticeably dated
  • 770 pages is a commitment and the writing is functional rather than enjoyable
  • Packt production quality is inconsistent, with some typesetting and figure issues
  • The final chapters on GNNs and reinforcement learning are too short to be much use
  • Overlaps heavily with Geron's book, and you probably do not need both

Detailed review

Raschka has been writing the same book, improving it, for about a decade now. It started as Python Machine Learning, went through several editions on TensorFlow, and this is the version where the deep learning half moved to PyTorch. That lineage matters, because the thing you get from a book that has been revised this many times is that the rough edges have been sanded down by thousands of readers filing issues. The code works.

The explanations have been reworked where people got stuck. It is a well worn path. The structure is the main reason to pick it. Roughly the first half is classical machine learning with scikit-learn, and it is not a token warm up.

Perceptrons and adaptive linear neurons implemented by hand, logistic regression, SVMs, decision trees and ensembles, dimensionality reduction, model evaluation and hyperparameter tuning, and a long careful chapter on data preprocessing. Then it moves to neural networks, first implemented from scratch in NumPy, then in PyTorch, and works up through CNNs, RNNs, transformers, GANs, graph neural networks and a closing chapter on reinforcement learning. The pattern Raschka uses throughout is to build the thing from first principles in plain NumPy, show you it working, then show you the library call that does the same job. This is the correct pedagogical order and a lot of books get it backwards.

When you have written backpropagation yourself, even a crude version, the PyTorch autograd machinery stops being a black box and becomes a labour saving device, which is what it is. The chapters people skip are the ones that do the most for your actual competence. Chapter four on preprocessing, chapter five on dimensionality reduction, chapter six on model evaluation and hyperparameter tuning. Nested cross validation, learning curves, why accuracy is usually the wrong metric, how to build a pipeline that does not leak information from your test set.

This is unglamorous material and it is the difference between somebody who can run a model and somebody who can be trusted with a result. Raschka covers it with the seriousness of somebody who has marked a lot of student work. Now the problems, and the biggest one is the date. This came out in February 2022.

In classical machine learning that is irrelevant, because logistic regression has not changed. In the deep learning half it shows. The transformer chapter is written from the perspective of BERT and GPT-2 fine tuning, which was a reasonable snapshot at the time and is now a historical one. There is nothing on instruction tuning, nothing on the parameter efficient methods that dominate practice, nothing on retrieval, nothing on the tooling that grew up around hosted models.

If you come to this book wanting to understand modern LLM work you will get the architectural foundations and none of the current practice. Take the first two thirds seriously and treat the last few chapters as background. The last few chapters have another problem, which is that they are too compressed to teach. Graph neural networks in one chapter and reinforcement learning in one chapter are gestures rather than instruction.

I would rather the book had ended fifty pages earlier and pointed you at Sutton and Barto. Then there is Packt. I have bought a lot of Packt books and the production is variable in a way that Manning and O'Reilly books usually are not. Figures that are hard to read, occasional formatting oddities, an index that could be better.

None of it is fatal and the content is much better than the typical output of that publisher, largely because Raschka is a much better author than the average person writing for them, but the physical object is not a pleasure. The writing itself is clear and correct without being a pleasure to read. Chollet writes prose you might quote. Raschka writes prose that gets the job done, which is fine for a technical book and worth knowing if you are choosing between the two.

The obvious comparison is Geron's Hands-On Machine Learning, which covers similar ground and is already on this site. If I had to choose one, I would take Geron for the writing and the scikit-learn depth, and this one for the PyTorch coverage and the from scratch implementations. Owning both is redundant. My 4.5 is for a book that is comprehensive, reliable and well sequenced, held back by a deep learning half that has aged in the three years since publication and a final act that runs out of room.

If Raschka does another edition it will probably be the best book in this category outright.

[ final ]

The verdict.

The best choice if you want one book that covers both halves of the field with real code. Buy Geron instead if you prefer scikit-learn and TensorFlow, or better writing.