Why you should start studying Quantum Machine Learning
Introduction
Hello! Thank you for stopping by in my first of many posts on Medium. Here I intend to write and share posts about Quantum Machine Learning (QML).
Why am I doing this and why Quantum ML?
In the last few months I have been thinking about career and future and that many tools that I currently work with nowadays did not exist 10 years ago, and then I thought: how things are going to be in 10 years from now? Well, the most honest answer is I don’t know, but I can try and make a guess!
The first time I heard about quantum computing was on 2015, when I was analyzing possibilities for my PhD dissertation, and my former boss and mentor told me about the possibility of studying about this subject. At the time, I wanted to study something more applied and quantum computing seemed too much theoretical and far away from my reality, so I chose to study more about modeling of Dynamic Positioning systems modeling for oil vessels, which was a fun ride. But part of me thinks nowadays: what if I chose quantum computing?
In the last months I started to read about quantum computing and more specifically QML. And since then I got really interested into this subject and I have a wild guess that the future in Data Science might have something to do with quantum computing.
Why you should start studying QML
Quantum computing is very different to classical on computing in the very basic concepts. While the latter is based on digital bits, the former is based on qubits (quantum bits).
On classical computing, the digital bit is built based on two states, 0 and 1. A digital bit can only have 0 or 1 as its states, as we all know, it is binary. Physically, a classical bit can be measured using a voltimeter in a circuit, and when the voltage difference is zero, the bit state is 0 and when this difference is 5V (or 3.3V depending of the circuit) we have the state 1. One bit by itself doesn’t seem a powerful tool, but things gets better when we start to use a higher number of bits, because then we can build very powerful devices, such as our computers.
The qubit has a more complex interpretation. In quantum mechanics, elementary particles have some properties and one of them is spin. For instance, let’s focus on electrons, but this concept can be extended for other particles. Electrons spin around an axis, so it can rotate in two different directions, up and down.
Let’s name these directions as 0 and 1. It seems like the classical bit, right? Now we start with the differences: while in classical computing I can measure the state of the bit with a single voltimeter, in quantum mechanics things are completely different, because now the events are probabilistics. In fact, a qubit has some probability to be in the state 0 or 1, which means that we are not always sure in which state our qubit is (if we measure the qubit, sometimes it will be 1 or 0, depending on the probabiliy)! This looks troublesome at first, but this one of the charms of quantum computing, the qubit is way more powerful compared to a classical bit, because it can store much more information! It can work as a classical bit if we work with 100% probability in state 0 or 1, but the real deal is working with superposition, which is a mixed state, where the qubit has some probability of being in state 0 or 1, and the sum of these probabilities must be 1 (100%). Using a little bit of math, a quantum state in a one qubit system can be represented as:
where:
And what are these | and >? These are the base notation for quantum computing, bra (<|) and ket (|>), in which a quantum state is a ket (nx1)and the bra (1xn) is its transposed conjugate. A bra-ket is the the matrix multiplication between a bra and a ket and results into a scalar (a.k.a. inner product) and a ket-bra is a matrix with dimension nxn and might represent a quantum gate, but this is something for a future post.
Here I am saying that the quantum state can be represented as α times the state 0 plus β times state 1, where α and β are complex numbers, with the constraint above, which models the probability.
Thereby, the first reason I think QML is going to be a big thing is: quantum computing is based on probabilistic events on its core, which is on the core of ML models.
Also, when we work with more than one qubit thing get even more interesting, because we can entangle qubits! But what is this?
Imagine that we have 2 qubits now, then we have four possible states:
|00>, |01>, |10> and |11>
Now we can write a generic quantum state in the following way:
where:
So, now our quantum state is a linear combination of the four basic quantum states (remember the linear algebra requirement?) and the probabilities of belonging in each state summing 1.
But now, with 2 qubits we can design a quantum circuit in which we can entangle the states of each qubit. And what is that? The spin rotation of my first qubit will depend on my second qubit and vice-versa, that is, the spin state of the electrons are no longer independent states! I won’t talk about quantum circuits now because it might be too much to begin with.
All that I said was for 1 and 2 qubits systems, did you notice that we can do much more things with a 2 qubit system than we can do with a 2 digital bits system?
And now I can say the second point on why I think QML will be huge: we can process more information in small qubits systems (compared to classical bits) and build interesting models.
Continuing with this argument, a n qubit system has 2^n possible states that might be in superposition and/or entangled and this already leads to my third point, which is a consequence of the second: in the best case scenario, a quantum computing algorithm can provide an exponential speed-up compared to an equivalent classical computing algorithm.
This IS huge, right? But things are tricky in reality, because this doesn’t occur to every algorithm, in some cases the classical computer still is faster. Furthermore, we are still progressing in quantum hardware, so our quantum computers are still limited in the amount of qubits (but there is a quick evolution) and most computers are somewhat noisy, which interferes the quality of calculations.
Up until now I just talked about quantum computing, what about QML? Well, quantum computing seems to be a very promising framework to use Machine Learning, but we still are unsure on what is the best way to use it. Firstly because it is a very new field of study and secondly because we still have some limitations regarding the use of a quantum computing (I must use a quantum device simulator on Python). But there are a lot of studies going on and I think it is a matter of time for us to find the best way to use QML and when that happens a new revolution in AI will begin. And this is the last and most important reason to start studying QML.
In my next post I will talk about how to start studying QML according to my learning journey.
Here are some readings about some topics I mentioned in this post (nothing very formal):
Quantum states: https://en.wikipedia.org/wiki/Quantum_state
Challenges of quantum computing: https://universalinstitutions.com/the-challenges-of-quantum/
Quantum speed-up: https://www.microsoft.com/en-us/research/blog/quantum-speedups-for-unstructured-problems-solving-two-twenty-year-old-problems/