Python 3 For Machine Learning

Author: Oswald Campesato
Publisher: Mercury Learning
Pages: 364
ISBN: 978-1683924951
Print: 1683924959
Kindle: B084P6L424
Audience: Python developers interested in machine learning
Rating: 4
Reviewer: Mike James
Python is the language most used for AI, so why not learn both in one book?

I have to admit that I am surprised that interest in machine learning or AI general is sufficient to warrant a book that teaches you Python at the same time? It seems I am wrong.  Python is indeed the most popular language for AI, but is there any synergy in learning it alongside how AI works?

The first few chapters of the book form a perfectly standard introduction to Python. Chapter 1 helps you install it and understand the very basics. The pace is fast and if you haven't programmed before might be too fast. Chapter 2 introduces the basics of flow of control and function. Again the pace is fast and covers some more advanced ideas such as lambda expressions, recursion and so on. Chapter 3 is all about Python collections which is a very big part of using Python. This brings the coverage of Python proper to an end. That's the whole of Python in less than 100 pages. No mention of objects or using Python as an object-oriented language - this would, of course, be impossible in such a short account? Does this matter? Probably not as many a programmer uses Python without realizing that it is object-oriented. You can achieve most of what you want to simply calling functions or using objects created by other people.


Chapter 4 marks the start of the look at machine learning. It introduces NumPy and Pandas, the two libraries that are needed to do data processing and machine learning. It starts out with basic data structures - the array, the list, and eventually the Pandas dataframe. These are the skills you need to actually do anything much with data.

Chapter 5 is where the machine learning starts. First it presents some very classical techniques, beginning with Principle Components analysis (PCA), but quickly moves on to more recent ideas - cross validation and regularization. From here we move back to classical stats - R squared, significance, linear regression and so on. The next chapter takes us deeper into classification techniques - nearest neighbour, decision trees, random forests, support vector machines, Bayes and so on. Neural networks make an appearance here, but only just. There is a section on activation functions as a way of allowing multi-stage learning not to simply collapse to a single linear stage. If you don't already know about neural networks my guess is that this is going to go over your head. There are no examples of building and using a network. It might have been better to have left this section out of the book.

The final chapter does a complete change of topic. It deals with natural language processing (NPL) which is not what you might expect in a book on machine learning. This introduces the idea of NLP and the basic algorithms. It doesn't give examples or any Python code and it is a very hands-off, high-level view. The most it can do is to familiarize you with the terms and what sorts of things you need to look into.

The book finishes with three long appendixes. The first on regular expressions could well have been omitted or moved to a full chapter. The second and third on using Keras and Tensorflow really should be full chapters and not tucked away at the back.

For a book of its size it covers a lot of ground and this should be taken as a warning if you are looking for something slow and steady. The part on Python would serve you well if you need a quick introduction or refresher on the language. The part on machine learning doesn't cover neural networks, which is the topic that is most likely motivating your interest in machine learning, in any depth.

This is a well-written book with quite a few insights, but it is far from complete or in depth. As a summary of Python or machine learning it leaves a lot out. You might find it useful as quick introduction before you move on to learn more.


  • Mike James is the author of Programmer's Python: Everything is an Object published by I/O Press as part of the  I Programmer Library. With the subtitle "Something Completely Different" it is for those who want to understand the deeper logic in the object-oriented approach that Python 3 takes to classes and objects.

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.


Data Structures and Algorithms in C++: Pocket Primer

Author: Lee Wittenberg
Publisher: Mercury Learning
Pages: 200
ISBN: 978-1683920847
Print: 1683920848
Kindle: B071CMSFHF
Audience: Student developers
Rating: 4
Reviewer: Mike James
Data structures are the core of many a computer science course and a book explaining them in C++ is a great idea.

 [ ... ]

Supercharged Python

Author: Brian Overland and John Bennett
Publisher: Addison-Wesley
Date: July 2019
Pages: 672
ISBN: 978-0135159941
Print: 0135159946
Kindle: B07T93J28B
Audience: Python developers
Rating: 3
Reviewer: Mike James
This book's challenge on its front cover is "Take Your Code to the Next Level". Is this the boo [ ... ]

More Reviews

Last Updated ( Tuesday, 28 July 2020 )