Reader small image

You're reading from  A Practical Guide to Quantum Machine Learning and Quantum Optimization

Product typeBook
Published inMar 2023
PublisherPackt
ISBN-139781804613832
Edition1st Edition
Right arrow
Authors (2):
Elías F. Combarro
Elías F. Combarro
author image
Elías F. Combarro

Elías F. Combarro holds degrees from the University of Oviedo (Spain) in both Mathematics (1997, award for second highest grades in the country) and Computer Science (2002, award for highest grades in the country). After some research stays at the Novosibirsk State University (Russia), he obtained a Ph.D. in Mathematics (Oviedo, 2001) with a dissertation on the properties of some computable predicates under the supervision of Prof. Andrey Morozov and Prof. Consuelo Martínez. Since 2009, Elías F. Combarro has been an associate professor at the Computer Science Department of the University of Oviedo. He has published more than 50 research papers in international journals on topics such as Computability Theory, Machine Learning, Fuzzy Measures and Computational Algebra. His current research focuses on the application Quantum Computing to algebraic, optimisation and machine learning problems. From July 2020 to January 2021, he was a Cooperation Associate at CERN openlab. Currently, he is the Spain representative in the Advisory Board of CERN Quantum Technology Initiative, a member of the Advisory Board of SheQuantum and one of the founders of the QSpain, a quantum computing think tank based in Spain.
Read more about Elías F. Combarro

Samuel González-Castillo
Samuel González-Castillo
author image
Samuel González-Castillo

Samuel González-Castillo holds degrees from the University of Oviedo (Spain) in both Mathematics and Physics (2021). He is currently a mathematics research student at the National University of Ireland, Maynooth, where he works as a graduate teaching assistant. He completed his physics bachelor thesis under the supervision of Prof. Elías F. Combarro and Prof. Ignacio F. Rúa (University of Oviedo), and Dr. Sofia Vallecorsa (CERN). In it, he worked alongside other researchers from ETH Zürich on the application of Quantum Machine Learning to classification problems in High Energy Physis. In 2021, he was a summer student at CERN developing a benchmarking framework for quantum simulators. He has contributed to several conferences on quantum computing.
Read more about Samuel González-Castillo

View More author details
Right arrow

Chapter 12
Quantum Generative Adversarial Networks

Fake it ‘till you make it
— Someone, somewhere

So far, we have only dealt with quantum machine learning models in the context of supervised learning. In this final chapter of our QML journey, we will discuss the wonders and mysteries of a QML model that will lead us into the domain of unsupervised learning. We will discuss quantum versions of the famous Generative Adversarial Networks (often abbreviated as GANs) that are called Quantum Generative Adversarial Networks, quantum GANs, or QGANs.

In this chapter, you will learn what classical and quantum GANs are, what they are useful for, and how they can be used. We will begin from the basics, exploring the intuitive ideas that lead to the concept of a GAN. Then, we will get into some of the details and discuss QGANs. In particular, we will talk about the different types of QGANs out there and their (possible) advantages. You will also learn how to work with them using PennyLane...

12.1 GANs and their quantum counterparts

Quantum GANs are generative models that can be trained in a perfectly unsupervised manner. By the fact that they are generative models we mean that quantum GANs will be useful for generating data that can mimic a training dataset; for instance, if you had a large dataset with pictures of people, a good generative model would be able to generate new pictures of people that would be indiscernible from those coming from the original distribution. The fact that QGANs can be trained in an unsupervised fashion simply means that our datasets will not have to be labeled; we won’t have to tell the generator whether its output is good or bad, the model will figure that out on its own. How exactly? Stay tuned!

That’s the big picture of GANs, but, before we can explore all their details, there’s something we need to talk about. Let’s talk about how to counterfeit money.

12.1.1 A seemingly unrelated story about money

Of course...

12.2 Quantum GANs in PennyLane

In this section, we are going to train a purely quantum GAN that will learn a one-qubit state. In our previous counterfeiting example, we imagined ourselves as behaving like a GAN in order to replicate some training data (a banknote) to produce fake banknotes that, ideally, would get closer and closer to the real thing in each iteration. In this case, our training data will be a one-qubit state, characterized by some amplitudes, and the job of our QGAN will be to replicate that state without the generator having direct access to it. Our dataset, then, will consist of multiple copies of a one-qubit state, and our goal will be to train a generator able to prepare that state (or something very close to it).

To learn more

Notice that this setting does not violate the no-cloning theorem that we proved in Section 1.4.5. We will have multiple copies of the same quantum state and we will perform operations on them, including measuring them (and, hence...

12.3 Quantum GANs in Qiskit

An early proposal of a QGAN was introduced by IBM researchers Zoufal, Lucchi, and Woerner [101] to learn a probability distribution using a QGAN with a quantum generator and a classical discriminator. In this section, we will discuss how to implement this kind of QGAN with Qiskit, so let’s put everything in more precise terms.

This type of quantum GAN is given a dataset of real numbers that follow a certain probability distribution. This distribution may potentially be continuous, but it could be discretized to take some values with ; this will usually be done by fixing the values and , rounding the samples and ignoring those that are smaller than or bigger than . Each of the resulting labels will have a certain probability of appearing in the dataset. That is the distribution that we want the generator in our QGAN to learn.

And what does the generator of these QGANs look like? It is a quantum generator that is dependent on some classical parameters...

Summary

In this chapter, we have explored a whole new kind of quantum machine learning models: quantum GANs. Unlike the models we had considered before, these are used primarily for generation tasks. And, unlike our previous models, they are trained in a fully unsupervised manner.

After understanding what GANs are in general, we introduced the general notion of a QGAN, and then we learned how to implement a couple of QGAN models using PennyLane and Qiskit.

With this, we also conclude our study of quantum machine learning for this book. We hope that you have had a good time learning about all these ways of making quantum computers learn! But your quantum journey does not need to end here. Please, keep on reading for a sneak peek of what you can expect in the near future in the quantum computing field.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
A Practical Guide to Quantum Machine Learning and Quantum Optimization
Published in: Mar 2023Publisher: PacktISBN-13: 9781804613832
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Elías F. Combarro

Elías F. Combarro holds degrees from the University of Oviedo (Spain) in both Mathematics (1997, award for second highest grades in the country) and Computer Science (2002, award for highest grades in the country). After some research stays at the Novosibirsk State University (Russia), he obtained a Ph.D. in Mathematics (Oviedo, 2001) with a dissertation on the properties of some computable predicates under the supervision of Prof. Andrey Morozov and Prof. Consuelo Martínez. Since 2009, Elías F. Combarro has been an associate professor at the Computer Science Department of the University of Oviedo. He has published more than 50 research papers in international journals on topics such as Computability Theory, Machine Learning, Fuzzy Measures and Computational Algebra. His current research focuses on the application Quantum Computing to algebraic, optimisation and machine learning problems. From July 2020 to January 2021, he was a Cooperation Associate at CERN openlab. Currently, he is the Spain representative in the Advisory Board of CERN Quantum Technology Initiative, a member of the Advisory Board of SheQuantum and one of the founders of the QSpain, a quantum computing think tank based in Spain.
Read more about Elías F. Combarro

author image
Samuel González-Castillo

Samuel González-Castillo holds degrees from the University of Oviedo (Spain) in both Mathematics and Physics (2021). He is currently a mathematics research student at the National University of Ireland, Maynooth, where he works as a graduate teaching assistant. He completed his physics bachelor thesis under the supervision of Prof. Elías F. Combarro and Prof. Ignacio F. Rúa (University of Oviedo), and Dr. Sofia Vallecorsa (CERN). In it, he worked alongside other researchers from ETH Zürich on the application of Quantum Machine Learning to classification problems in High Energy Physis. In 2021, he was a summer student at CERN developing a benchmarking framework for quantum simulators. He has contributed to several conferences on quantum computing.
Read more about Samuel González-Castillo