Back to index
OtherAround 400 pages across 12 chapters, three to six months worked properly·Free PDF from the authors, around $40 in print

Mathematics for Machine Learning (Deisenroth, Faisal and Ong)

4.4

If you keep bouncing off machine learning textbooks because the maths is assumed, this is the book that fixes it. It is a prerequisite text and it knows exactly what it is for.

What We Liked

  • Free PDF, permanently, from the authors' own site
  • Selects only the mathematics that machine learning actually uses, which is rarer than it sounds
  • Part two shows the foundations paying off on real ML problems rather than leaving you to guess
  • Notation is consistent throughout, which is a genuine kindness
  • Exercises with solutions, plus Jupyter tutorials for the second half

What Could Be Better

  • Still a maths book, so it demands real work and there is no shortcut through it
  • Sparse on worked examples in the early chapters, which is where beginners need them most
  • Not enough on information theory given how much modern ML leans on it
  • The 2020 publication means nothing on the mathematics behind current architectures
  • Anyone genuinely starting from scratch will need something gentler first

Detailed review

There is a recurring pattern I see with self taught people trying to move from using machine learning libraries to understanding what they are doing. They pick up Bishop or Hastie, get four pages in, hit a covariance matrix or a gradient of a matrix expression, and quietly close the book. The gap is not intelligence and it is not effort. It is that those books assume a specific mathematical vocabulary that most programmers were never given and that most general maths courses do not teach in the right shape.

This book exists precisely for that gap and it is the best attempt I have seen at closing it. The design is unusually disciplined. Part one is seven chapters of foundations: linear algebra, analytic geometry, matrix decompositions, vector calculus, probability and distributions, continuous optimisation. Part two is five chapters that use them, covering linear regression, dimensionality reduction with PCA, density estimation with Gaussian mixture models, and classification with SVMs.

That split is the whole idea. The maths is not presented for its own sake and it is not presented exhaustively. It is presented because you are going to need it in chapter nine, and then in chapter nine you need it. The discipline shows most in what has been left out.

There is no attempt to teach linear algebra as a mathematician would. Eigenvalues, singular value decomposition and matrix factorisations get real attention because ML uses them constantly. Things a pure course would spend weeks on are absent because they never come up. Same with calculus, where the emphasis is squarely on gradients, Jacobians, the chain rule in multiple dimensions and automatic differentiation, because that is the machinery underneath every training loop you will ever write.

Somebody made a lot of decisions about scope here and almost all of them were the right ones. The consistency of notation deserves specific praise. Reading across several ML textbooks is miserable partly because everybody uses different symbols for the same object, and a lot of the difficulty people attribute to the mathematics is actually the friction of translation. This book fixes its conventions early and holds them, and by chapter nine you can read an equation without stopping to work out what each letter means.

That sounds minor. It is not. The second part is where the book earns the recommendation over a general maths text. Deriving linear regression from a probabilistic starting point, deriving PCA in two different ways and showing they arrive at the same place, working through the expectation maximisation algorithm for mixture models.

These are the moments where the abstraction pays out and you see why you spent three weeks on matrix decompositions. Without part two this would be a competent maths textbook. With it, it is an argument. Now the honest limits.

It is a maths book, and it will take you months if you do it properly, meaning exercises rather than reading. There is no version of this that is quick. If you are looking to be waved through you will be disappointed and you should adjust expectations rather than blame the book. My real criticism is the density of worked examples in part one.

The exposition is clean but sparse, and the early chapters in particular could use two or three more fully worked problems each. For a reader who is genuinely shaky on linear algebra, going from a definition to an exercise is a large jump, and this is exactly where people give up. The Overleaf exercise sets and the notebook tutorials help, but the main text could carry more of that load itself. There are gaps in coverage too.

Information theory gets much less space than its importance warrants, given that entropy and KL divergence appear everywhere from variational methods to the loss function of every language model. Graph theory is absent. And the book is from 2020, so there is nothing on the mathematics that has become relevant since, particularly around attention and the linear algebra of large scale training. The foundations do not expire, but a reader hoping for a bridge to current papers will find it stops short.

The prerequisite question is worth being blunt about. This is pitched at somebody with school level maths who is willing to work, but in practice you will have a much better time if you have seen calculus and basic matrices before, even badly and long ago. Somebody truly starting from zero should do a friendlier course first, and 3Blue1Brown's linear algebra and calculus series are the obvious free option, then come here. My 4.4 reflects a book that solves a real and widespread problem, gives itself away for free, and is thoughtfully scoped.

It loses ground for being thinner on worked examples than its target reader needs, and for a couple of omissions that matter more now than they did in 2020. If you have been faking your way through the maths, this is the book that stops you having to.

[ final ]

The verdict.

The right book for the person who can code, wants to read papers, and keeps getting stopped by the notation. Not a first maths book, but the best second one.