Intro into Quantum Computing and Machine Learning

Jari El
7 min readDec 6, 2020

While enjoying my journey exploring the tech world and data science, I have come across many things that have piqued my interest to a point in which I firmly believed that nothing else could. There are a lot of things that you can teach the computer to do such as, predict the future and create its own art. These are powerful and fascinating applications in their own right. But, there are many complexities and convolutions that come with this great power. I learned this first hand. One of my favorite projects that I am currently working on using a generative model created by scientists at M.I.T. titled, The Conditional Tabular GAN. (If you are interested in Generative models or CTGAN read my other article: https://drjariel.medium.com/introduction-to-generative-modeling-d4e321f61474). I was able to generate a synthetic dataset from the Pump it Up: Data Mining the Water Table competition hosted by Datadriven. This was a 59,000-row dataset. It was a success! I was able to generate a 56,000-row synthetic dataset that was used as the training data for a Random Forest classifier. The model performed well in my opinion, it was able to achieve 71% accuracy, the highest accuracy at the time for the competition was roughly 82%. To me, this is a win. But the backend of the experiment brings to light a familiar story with machine learning, neural nets, and specifically GAN’s, the computer can take an exceptionally long time to train the model’s on a large size dataset. For instance, I only set the model trained 1000 epochs and on only 15000 samples of the 59,000 available, it took over 2 hours. But this is very subjective, some models can take months or years and even theoretically forever to train and solve some problems such as encryption. I love modeling, but our conventional methods are somewhat rudimentary. This led me to try and find new methods, which then I was exposed to Quantum Computing and Quantum Machine Learning.

Quantum Computing is a sector of Computer Science that focuses on technology that is based on Quantum Theory. The Quantum Theory was proposed in the early 1900s. It theorizes that particles on a sub-atomic level can travel as waves and particles at the same time. Simply put, most sciences dealing with anything “quantum” are dealing on the sub-atomic level. The main goal of Quantum Computing is to process and do things faster than our classical computers. And the theory of Quantum Machine Learning takes the theory of classical Machine Learning and looks at it through the perspective of Quantum Computing. I hope in this article to share some basics on the amazing world of Quantum Computing and Quantum Machine Learning.

The best place to start is with the building blocks of traditional computers as well as quantum computers. The most fundamental building blocks in computers is probably unknown to many in the world. The “bit”, is our main source of communication with our classical computers. It is the idea that data can be stored in 1’s and 0’s, and that is how classical computers work. It can be thought of as a transistor, high voltage represents 1’s and low voltage represents 0’s. This is how almost everything on a classical computer works from messages to media, quantum computers work on a similar premise. The “qubit” is the basis for quantum computing, which stands for Quantum Binary Digit. Where the qubit differs from the bit, is a bit can only be 1 or 0 where a Qubit can occupy all positions at the same time: 1 & 0, 1 & 1, 0 & 0, 0 & 1 (This will be discussed in more depth later). This is due to the qubit acting as both a particle and a wave. A wave distribution stores a lot of data, as compared to a particle (or bit).

Now having some knowledge of how both classical computers and quantum computers work it is a good time to discuss some higher-level differences between classical Machine Learning and Quantum Machine Learning. While some mechanics are similar in both forms of Machine Learning there is one defining aspect that separates the two. Towards the end of the classical Machine Learning process, a loss function is used to see the model’s accuracy. While training, the model is bound to get predictions wrong, and the loss function is a way of keeping track of this. A Quantum Computer also aims to reduce the loss function. It has a property called Quantum Tunneling which searches through the entire loss function space and finds the value where the loss is lowest, and hence, where the algorithm will perform the best and at a very fast rate. This is one of the many aspects that separate the two.

Basics of Quantum Computing

To continue your learning Quantum Machine Learning effectively, there is some terminology that we should review.

Bra-ket Notation and Linear Algebra

To my surprise (not sure why I was surprised) quantum computing is mostly linear algebra. The way in which you manipulate the qubits is pretty much matrix manipulation. But to even begin to understand the math aspect you must know the langue in which this particular math is written in. It is called “Bra-ket” notation or “Dirac” notation, and it is used to write equations. This is very important to quantum beginners because academic papers are riddled with Bra-ket Notation.

Bra-ket Notation uses angle brackets,〈〉, and a vertical bar ⎢ to build “bras” and “kets”.

What follows is the basis of Linear Algebra

A “ket” looks like this |v〉. Mathematically it denotes a vector, v, in a complex vector space, V. The vector space is where all vectors live.

A “bra” looks like this:〈f|. In mathematics, it denotes a linear function f: V ➝ C, an example being, a linear map that maps each vector in V to a number in the complex plane C.

Allowing a linear function like this:〈f| act on a vector |v〉is denoted as:

〈f|v〉⍷ C

Quantum states such as wave functions can be represented as vectors in a complex state using Bra-ket notation. The term Quantum Superposition can also be denoted using this notation.

Qubits & Superposition

To the contrary of the classical computer’s bit, in Quantum Computing we use the “qubit” as stated above. Just to recap, a bit can only hold one of two positions, 1 or 0. Unlike the qubit who can hold all positions at the same time. Yes, this was a complex idea for me at first and I think an example would serve as the best way of clarifying. Say we are doing an experiment in which we are seeing if you can guess which hand I am holding a dollar bill. Before choosing, can you know which hand is the correct hand? No, not until you choose a hand, there is a chance that it could be in both hands. This is the case with qubits. This is called the superposition of two states. This shows that the probability of measuring 1 or 0 before a decision is generally neither 0.0 nor 1.0. Furthermore, this shows that there is a likelihood that the qubit is in various states at once. In the instance of our experiment when you choose a hand, the superposition collapses because we now know.

The Bloch Sphere

Bloch’s Sphere

The Block Sphere is the mathematical representation of a qubit. It helps to represent the state of a qubit by a two-dimensional vector. This vector has two elements: a real number α and a complex number β. Qubit’s can be considered as a superposition of two states and can be denoted as follows:

|ψ〉 = α |0〉 + β |1〉

Quantum Entanglement

The idea of Quantum Entanglement refers to the idea that if we take two qubits, they are always in a superposition of two states. Here is a classic example. Say we have a box with a pair of gloves inside. At random you are asked to take one of the gloves out of the box. The box is then taken to a different area. The glove that was taken out was found to be left-handed, therefor we automatically know that the other glove is right-handed. The same is the case with qubits. If one is in a spin-up position, then the other is automatically in the spin-down position. There does not exist a scenario where both the qubits are in the same state. In other words, they are always entangled. This is known as quantum entanglement.

Quantum Speedup

A quantum model performs a stepwise procedure to solve a problem, such as searching a database as stated above. Quantum Coherence helps the quantum computer to process information in a way classical computers cannot. This phenomenon is referred to as Quantum Speedup.

I hope this will serve as a good introduction to Quantum Computing. This is a very heavy topic that takes some time to process and to understand fully. These concepts are fundamental in going forward with Quantum Machine Learning. Please watch out for my part two coming soon. I hope to go more in-depth with the actual Quantum Machine Learning methods.

--

--