Sunday, May 25, 2014

Book review: "Clojure for machine learning"

I had the opportunity to give my opinion about a book that I expected to read. After having encountered some issues dealing with Incanter matrices (a ML framework for Clojure programers), I googled my issue and got answers that seem to be part of Clojure for Machine Learning book (Packt Publishing). Of course, the book wasn't entirely available online, so you can imagine how I felt when I got the whole copy three days later for review.

First of all, it was the first time I've read a book from Packt. I have to admit it was even the first time I've heard about Packt. I can't say I was amazed by the layout and print styles, but it's more than acceptable (and totally subjective!).

Machine Learning

Well, it's time to talk about the content. I know it's always hard to provide well balanced explanations of machine learning algorithms: too academic books become so boring for those who already master the concepts and underlying mathematics (and for those who absolutely don't have any maths background). Too pragmatic books, at the contrary, can be interesting and relevant but most of the time it becomes quite hard to apply concepts to other use cases and problems, and it can be frustrating to not know how and why everything is working. The author explains his point of view at the early beginning of the book: it aims to be at the middle of this large scale, wants to cover most relevant problematic in a generic fashion but avoids diving too deep into low-level maths. What a challenge!


What about Clojure content? I'm still considering myself as a Clojure beginner since I didn't write any large program nor solved really hard issues. Even if I deeply know and understand all the concepts individually, it remains not-so-easy to gather all of them and think everything in a perfect Clojure's style when I have to solve real life problems. Until now I mostly played with Machine Learning algorithms using GNU Octave or Python. This books looks perfect in this dimension! The author provides clear Clojure code, assuming you already know Clojure fundamentals and giving relevant notes for lines that deserve further explanations.

Clojure for Machine Learning

Mixing these 2 axis together, you get this book. At first sight I was surprised to not see any reference to Incanter project. You just have to wait and keep reading, then this book will transform into a nice Incanter introduction. However, I had the feeling the author didn't want to speak too much about Incanter but he had to anyway (just a personal feeling). I think it would make sense to explicitly introduce this amazing project and would't mean that the book was 100% single-library oriented.

The first part I really liked within the first chapters was the nice introduction to available frameworks to deal with matrices (and not Incanter!). It calls into question how I considered matrices in Clojure so far. I just regret some figures are missing but it highly motivates me to write these benchmarks.

Another point I realized is the strange overall organization of this book. Despite the table of content makes it very clear, I think the author is doing strong shortcuts, bypassing some important concepts; on the other hand he supplies long and deep details about some fundamentals (mostly about ML, not really about Clojure). Make your choice: there is too much theory or not enough theory.

Worth reading?

To be honest, I don't know. I guess it depends who you are, and what you'll expect from this book. The best I can do is give this classical overview as pros/cons list.


  • Nice introduction to LOTS OF concepts
  • Pragmatic, real-life oriented
  • Well-balanced required Clojure's skill
  • Fair level of details overall


  • Lack of fundamentals / academic stuff
  • Lack of summarized explanations
  • No real Incanter introduction
  • Not enough organized