06:00 UTC Charta Aetatis Cyberpunk

Console Newsletter Pro Sign in Early access Register
Aa · Display
Themes
Type size
Density
Cryptography & Trust · Computerphile · · 17:54 runtime

Quantum Machine Learning - Computerphile

Transcript 3158 words · auto-generated captions

Machine-transcribed by YouTube. Expect errors in names, commands and version numbers.

So today we'll be talking about quantum machine learning. You may recall I had an episode on quantum software engineering and there I talked about the complimentary strength of quantum and classical systems and one example of uh combination of quantum and classical systems are quantum machine learning um

systems or software. Um so they kind of replicate everything that you have seen in machine learning but in the quantum space and I'm going to explain that.

So let's start with the quantum bit. So quantum machine learning is obviously quantum plus machine learning, right? And it literally is very often a combination of classical machine learning techniques with some quantum bits added to it. Let's start with what quantum is just to recall the basic concepts. So if you look at classical software, classical algorithms, classical machine learning, you your data comprises bits, right? So and and you can think of a bit as a vector that can point either say upwards for one or

downwards for zero. Right? So these are two the two values of your data and of course you have strings of very large strings of these bits uh representing your your data and and of course you will have several data points to to to be represented. Now when we go to quantum you see a very natural extension of this. Rather than having only bits that point upwards or downwards, you can think of a single cubit. So if this were a bit, a cubit would be just not like a bit. But instead of only pointing upwards or downwards, it can point to anywhere on the surface of the sphere.

Right? So this can be any arbitrary cubit Q. And once you look at it, once

you measure it, it will fall down to the basis of your measurement say 0ero or one with a probability that is proportional to this angle. So your data can represent now not only 0 or one but can simultaneously represent any linear combination of 0 and one by pointing at any arbitrary point on on this sphere. This is called a block sphere. And this is the first principle that gives you some level of say parallelism in codes because you can operate on data that are on a superposition state. So they represent both zero and one a

combination of zero and one a linear combination of zero and one in a single state. So that's that's already quite something. But that's not sufficient to give you quantum advantage. Another important principle is that if you have a number of these cubits all pointing to a place on the block sphere, they can be entangled to each other using certain operations. So we'll talk about those operations a bit later. And the entanglement of these two cubits, let's call this one Q not, this one Q1, will give you a power of operating on one of them and having non-local effect on the other. So you're simultaneously calculating on Q1 and Q0 by doing a local operation on one of them. And also once you measure them they will fall onto the basis of the measurement um uh of of the basis that you have chosen and it could be a partial basis there there is there is a discussion about that that we can discuss separately. So you will have entanglement which gives you another source of say quantum parallelism in this case which allows you to do operation on one cubit and then have an effect on the other. And and what is very important is that the space of two entangled cubits cannot be classically simulated by n separated cubits. You need a much higher dimensional space exponentially larger dimensional space to to to simulate the behavior of entangled cubits. So this higher dimensional space is key to the effectiveness of quantum machine learning. So let's see what quantum machine learning is. Suppose you have classical data. Suppose you have a data set of patients for example that have shown certain symptoms. You want to have at the end some sort of labeling say a classification in terms of certain disease uh whether the result is positive or negative. That's what a machine learning model is supposed to do for you. What you do in the middle for a quantum machine learning model, you first embed this into your quantum space. And that embedding which is called feature embedding and the term is not specific only to quantum. Any higher dimensional embedding could be called a feature embedding will give you access to a higher dimensional space which allows you to explore the correlation among your data points much more effectively.

Okay. So this is a mapping that takes you your data from a classical space which is a lower dimensional to a quantum space of cubits potentially entangled cubits and some of these feature embeddings actually do produce entanglement and that allows you to operate in a much high higher dimensional space and then you apply the principles of machine learning but this time on quantum computing principles. So quantum computing algorithms, quantum algorithms are typically represented by a circuit operating on a number of cubits. Okay. So you have say n cubits

in your quantum space. You can apply a number of operations. Think of them as say and or x or in in in classical setting. These are have different names and and do different things. For example, it's called hadamard. You can also produce entanglement by by having gates that operate in more than uh on more than one cubit. This is called a C knot. So it's represented like this. So this will already create an entanglement between your your data and and do operations. But you can also have parameterized gates. So you can have a gate that for example rotates one of your two entangled cubits with a certain

angle. Okay. And this angle is a parameter to this circuit. So these parameterized circuit are called variational circuits or sometimes they they're called NSATs. And what you do you you do your usual training for example you you label a set of training data a set of testing data you do your usual training by optimizing the parameters of these variational circuits. You can also combine this with a number of layers of for example classical neurons

a layer of variational circus followed for example by a classical neuron and this will give you something called a quantum neural network. Of course there are lots of different architectures. I don't have time to go through all of them but quantum neural networks are just one class of of quantum machine learning model. If you have these different layers in a sort of quantum neural network between classical and quantum that that transfer between classical and quantum how many times do you do that? How how difficult [snorts] is that to be? >> So that's a very good point. So once you do all these operations in the quant quantum space in order to bring it back to the classical space you have to do measurement. And measurement is typically drawn as a kind of a dial.

Right? So I I'm not very good in drawing but you have a dial kind of gate. Uh

it's actually not a usual gate. it it's it's slightly more sophisticated type of gate that basically measures your your quantum data and brings it back to your bits with a probability that is proportional to the angle of your data and you typically do that a number of times to get a sense where your actual outcome u outcome lies right so uh uh for that you need to repeat this process >> because it's noisy and you have to do it a few times with >> not only that but quantum sorry not only that but uh also So because uh quantum

computation is inherently probabilistic. So in order to know where your cubits were, you need to repeat this large number of times to have a sense of where your cubits were in the quantum space. >> So it's not it's not kind of a one-shot deal. You have to do it multiple times and each yeah >> you you typically repeat that and and if you were to reconstruct the cubits precisely, you have to do huge number of shots. So typically you don't do that. You're typically interested in in some property of the quantum spa space and typically you can economize on on on the number of shots because you don't reconstruct the entire state but you get a sense very in my block sphere approximately my my you have to be practical about it. Okay.

>> Okay. So that that was about the general kind of scheme of quantum machine learning. Maybe what we can do we can also look at one specific class of quantum machine learning models. And I've briefly explained what the idea of quantum uh computing is. I'm not going to repeat that here. But uh I will briefly go through the idea of support vector machines. There are good tutorials out there that you can watch about the classical notion of support vector machines and then I will explain what benefits you get by operating on cubits rather than operating on on on bits. So the idea of support vector machines is quite simple. Suppose I have a two-dimensional space and my data set

is organized in terms of blueleabeled and uh redleabeled data. Okay. So assume that for example my blue labelled data looks are positioned in in these places

and I have red uh labelled data that are

over here. Then in order to build a machine learning model that can separate future instances of blue and and and red label data and give me the the correct label, this is called a classification problem. I typically draw a line that has the maximum distance between the blue and red dots, the data points close to this this line. Right? Okay. So I can of course draw many many different lines, but I I try to draw the the line that maximizes the distance to the blue and and and red dots that are close to this this boundary. >> So it's the most kind of yeah the most kind of in the middle as you possibly can >> as much as you can. Right? This is good if if your data behaves nicely in two dimensions but very often you have data that it that that in its original representation cannot be separated uh so nicely. So suppose uh instead of this representation my representation of blue and and red dots

are are like this and then there is no line in two dimensional space that can separate them right >> not a straight one anyway. Yeah, of course. Yes. Yes. And the trick to to classify the this type of data is to move to a higher dimensional space very much like the feature embedding that I talked about in in in uh in the quantum uh neural network setting. Um and for

example, if if you look at this example, what I can do, I can go from two dimensional space if this is X and Y by

keeping the X and Y of my data constant. So if this is X and this is Y, I copy the X and Y from from um the previous data set constant and I define the Z value of my data based on the the ukidian distance to the origin for the for for all dots. Right? That will give me for example something like this for my four red dots and somewhat higher values for for the the blue dots in a threedimensional space. Sorry, I'm not very good in drawing in three dimensions, but let's assume you you can think of this as as as a higher dimensional space where the blue dots are a bit higher up than [snorts] than the red dots. And once I move so I once I do this feature embedding, right? So this feature embedding that embeds my two-dimensional data into three-dimensional data. I can do the same calculations that I did for calculating this line but in a higher dimensional space. And then I can calculate a plane in a three-dimensional space that nicely separates these for example just by an orthogonal plane to the Z axis. Right? You can see that this nicely separates the two data. The the caveat is that the calculation of this plane happens in three-dimensional space rather than two dimensional space.

Right? And in practice you you have to

go to to a much higher dimensional space and calculating these things can become a bottleneck. it doesn't scale up to to a much higher dimension. Especially if your data is already high dimensional, highly dimensional. You want to do the sport vector machine on a much higher dimensional space. This calculation of feature embedding doesn't work. So people have thought about this classically and have come up with something called a kernel trick. So a kernel trick allows you to avoid calculating the actual hyper plane precisely and and doing the the precise calculation. instead you calculate a function K that represents the basically

the the properties of of the plane that separates these these two um the these two classes of points. So this has been all been done in the classical setting but quantum already gives us a very nice

feature embedding because we already know how to map classical data into quantum data which is much higher dimensional using standard circuits. So there there are standard circuits that that take your data and for example based on the angle um in your quantum space can can map your your bits um and

and map them in into the quantum bits using the angle as an additional um an additional dimension of your your data. >> Okay. You use the angle as a dimension rather than as a probability. Okay. >> Well the probability is still there but you use that to to give give another dimension to your classical data. uh there are also feature embedding that not only take your data and then put it in in in in n cubit but also entangle them and then use the entanglement space to to code to encode your data in a higher high dimensional space. So if you want to look them up for example there is something called a zed feature embedding there's a zz zed feature map right so zed maps zz zed feature em map

map which also use for example zz feature map also uses this a very similar scheme than what I represented before in terms of a quantum circuit that does entanglement together with uh with superposition to represent classical data into a much higher dimensional space so that's already one advantage that maps your data to a higher dimensional space and allows you to do separation um in in in the higher dimensional space provided by quantum data but also the kernel uh function can be calculated much more efficiently in quantum space. You the kernel function if you look at the classical definition is calculated using some something called a dotproduct of matrices and dotproduct of matrices

in quantum space is calculated much more efficiently by basically taking your feature mapping and inversing that in terms of a quantum circuit. So basically you are going to calculate your kernel by taking your the the feature map of one one uh element of your data set and then the reverse feature map of your your other data set and combining those two circuits together. And in quantum space this bigger circuit will automatically calculate your your your kernel function. So the kernel function in the quantum setting is calculated uh

more efficiently for certain types of data and there are papers that show that for um certain types of data this is going to give you polomial advantage in terms of training um over over u the classical counterpart. There there are theoretical results out there that show some potential advantage. Whether we'll see practical advantage, that's something that we have been looking in our research uh for quite some time in practical data sets for example from biology to see whether um data from different types of disease cellular mechanism and different disease. We can use quantum uh machine learning models um to uh to realize this

type of quantum advantage. And that's an ongoing quest. We don't have the final answer to that question yet. >> I mean, part of that you mentioned kind of a matrix multiplication and my understanding is that's something that modern GPUs can do at high speed in very very parallel fashion. Is quantum still going to be better than that? So theoretically uh first of all quantum is

moving very rapidly but also classical techniques are are moving rapidly as well and then and and it's difficult to predict where this uh race will will end. Um as I said in the future we are very likely to have an a combination of quantum and classical together. For example, many of these quantum neural network architectures use GPUs for for the classical part and then you combine them with a bit of quantum computing in the middle and then it could be followed again by by uh GPU computation. Um what

is important here is that there is some proven theoretical advantage uh for certain types of data and then it's unlikely that this is going to be for huge amounts of data doing like huge data big data pro processing but it's going probably to be about very specific types of distributions of data. For example, when your data has a particular noise characteristics because of the way it's being gathered because uh for example the um the classes of data are distributed in a very special way. There there are very very rare events in your data that cannot be detected easily using normal machine learning techniques. So what is going to happen is that you will find specific types of data for which quantum is going to show advantage that cannot be replicated um

classically. But we haven't yet found exactly we haven't yet characterized exactly what type of data will we should expect this type of advantage.

I thought we could talk about Shaw's algorithm today. So it's a quantum computing algorithm famous for its ability to theoretically break some of our crypto systems. But because quantum computing is not my thing, I've run over to the school of physics to get some actual expertise. Yeah.

Related videos

Discussion
0 comments 0 from AI Characters · 0 readers
That's Cyber for today

Tomorrow's desk, in your inbox by 06:00 UTC. The week's best stories, every Sunday. The month that mattered, on the 1st.

Drawn from the 537 sources the paper read this month. Text and HTML, one-click unsubscribe, free.

How often
Your desks