Hands-On Quantum Machine Learning With Python: A Review

Hands-On Quantum Machine Learning With Python: A Review

There is no question that machine learning and AI have taken the world by storm, with myriad products and services exploiting the ability of computers to learn from data without providing explicit rules. Whether self-driving cars from the likes of Tesla or extracting labels from images or even playing Atari video games, the field has created a great deal of excitement for its impact on almost every aspect of our lives. It should come as no surprise then, that researchers and developers are keen to find new and novel ways to exploit quantum computing to achieve learning. Here we take a first look at the new book by Frank Zickert which aims to be a hands-on guide to learning all about QML or Quantum Machine Learning.

QML – Quantum Machine Learning

Isn’t this just a fancy new term? Well, not really. The field is exciting and growing as more quantum resources are available, developers are finding new applications to deploy learning utilising quantum hardware. There are certainly a few areas such as Hybrid Neural networks which will be sure to excite those interested in deploying the latest technology. Recently we reviewed some of the QML algorithms in use within finance, which should help to motivate the reader that QML is not a plaything of researchers, but that organizations are keen to explore this field. There are new fields opening up as we speak which are marrying the potential of Quantum with machine learning. Companies such as Cambridge Quantum are leading the field named QNLP which aims to exploit Quantum NLP or Quantum Natural Language processing.

Quantum machine learning promises to be disruptive. Although this merger of machine learning and quantum computing, both areas of active research, is largely in the conceptual domain, there are already some examples where it is being applied to solve real-life problems. Google, Amazon, IBM, Microsoft, and a whole fleet of high-tech startups strive to be the first to build and sell quantum machine learning systems.

Hands-On Quantum Machine Learning With Python: A Review
Frank Zickert, the author of a new book: Hands-On Quantum Machine Learning With Python

The book is over 400 pages long so great value for money and the material is pitched that it can take someone completely new to Quantum and introduce some of the features of Quantum Computing to novices. Of course, readers more familiar will be tempted to dive into later chapters, but the early material on the basics of Quantum Computing is well thought out with carefully constructed diagrams that are cleverly designed to aid understanding without being confusing or complex. There is also an introduction to Quantum Machine Learning, allowing those with a Quantum bent, but perhaps not much experience in ML to refresh or review some of the salient aspects of Machine Learning.

There is a very personal “feel” about the book. In so much as this takes the experience of the author learning QML and tries to steer the reader in a direction such that the field is more amenable. Frank learnt the “hard way” and he clearly wants to ensure the reader gets a bit more an easier ride into the field rather than be stuck reading very theoretical works which, whilst important don’t always go full circle and provide code examples and worked examples. Hands-On Quantum Machine Learning With Python is more akin to Robert Sutor’s Book named “Dancing with Qubits” or Jack Hidary’s book on Quantum Computing. Both of those books use common quantum languages, with the former using, perhaps the most popular language/framework: Qiskit. Zickert also bases his book around Qiskit, which not only means there are plenty of users, but also plenty of resources too that can help users get acquainted easily. Not that we want to pick-sides in framework/language space as there are plenty out there such as Q# and Cirq and t|ket> but, just as python has become ubiquitous, Qiskit in our view has taken the mantel as the “python” of the quantum computing world. In summary, readers get an introduction to Qiskit, quantum all driven by python.

Hands-On Quantum Machine Learning With Python: A Review
One of the illustrations throughout the book showing the Quantum circuit for the Quantum Bayesian Network Circuit

Crucially the reader will get step-by-step examples they can run with ease. Frank has done a good job of covering the basic installation of all the tools and software the user needs to get going. Code examples are full and complete and the reader should be able to copy & paste and run in a Jupyter notebook (or can run using plain ‘ol python).

This book isn’t just a foray into Quantum, it does a really good job of covering some of the interesting classical ML algorithms such as Naive Bayes, Classifiers, which are then followed up with their Quantum algorithms, namely Quantum Naive Bayes for example. Some of the key algorithms that are currently being used in the field are VQE (Variational Quantum Eigensolvers) and there is an entire section dedicated to the Variational Hybrid quantum-classical Algorithm.

Here are some of the topics covered (not complete, but some of the sections of the book):

  • Qubit and Quantum States
  • Probabilistic Binary Classifier
  • TowardsNaïveBayes
  • Bayes’ Theorem
  • Gaussian Naïve Bayes
  • Working with Qubits
  • Working With Multiple Qubits
  • Hands‐On Introduction To Quantum Entanglement
  • Quantum Naïve Bayes
  • Quantum Bayesian Networks
  • Bayesian Networks
  • Bayesian Inference
  • Forward Sampling
  • Bayesian Rejection Sampling
  • Quantum Rejection Sampling

Readers who want to start their journey into Quantum (even ignoring QML), could do well with this book as the introduction material is good enough to cover the basics of Quantum Computing, especially for those without a very mathematical base. You can learn more about the author, Frank, at: PyQML or purchase the book from Amazon. Frank is giving away the first few chapters for free. We have also interviewed Frank about his motivations for writing the book on QML.