Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
A Practical Guide to Quantum Machine Learning and Quantum Optimization

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

Product type Book
Published in Mar 2023
Publisher Packt
ISBN-13 9781804613832
Pages 680 pages
Edition 1st Edition
Languages
Authors (2):
Elías F. Combarro Elías F. Combarro
Profile icon Elías F. Combarro
Samuel González-Castillo Samuel González-Castillo
Profile icon Samuel González-Castillo
View More author details

Table of Contents (27) Chapters

Preface Part I: I, for One, Welcome our New Quantum Overlords
Chapter 1: Foundations of Quantum Computing Chapter 2: The Tools of the Trade in Quantum Computing Part II: When Time is Gold: Tools for Quantum Optimization
Chapter 3: Working with Quadratic Unconstrained Binary Optimization Problems Chapter 4: Adiabatic Quantum Computing and Quantum Annealing Chapter 5: QAOA: Quantum Approximate Optimization Algorithm Chapter 6: GAS: Grover Adaptive Search Chapter 7: VQE: Variational Quantum Eigensolver Part III: A Match Made in Heaven: Quantum Machine Learning
Chapter 8: What Is Quantum Machine Learning? Chapter 9: Quantum Support Vector Machines Chapter 10: Quantum Neural Networks Chapter 11: The Best of Both Worlds: Hybrid Architectures Chapter 12: Quantum Generative Adversarial Networks Part IV: Afterword and Appendices
Chapter 13: Afterword: The Future of Quantum Computing
Assessments Bibliography
Index
Other Books You May Enjoy Appendix A: Complex Numbers
Appendix B: Basic Linear Algebra Appendix C: Computational Complexity Appendix D: Installing the Tools Appendix E: Production Notes

9.4 Quantum support vector machines in Qiskit

In the previous section, we mastered the use of QSVMs in PennyLane. You may want to review subsection 9.3.1 and the beginning of subsection 9.3.3. That is where we prepare the dataset that we will be using here too. In addition to running the code in those subsections, you will have to do the following import:

from sklearn.metrics import accuracy_score

Now it’s time for us to switch to Qiskit. In some ways, Qiskit can be easier to use than PennyLane — although this is probably a matter of taste. In addition, Qiskit will enable us to directly train and run our QSVM models using the real quantum computers available at IBM Quantum. Nevertheless, for now, let us begin with QSVMs on our beloved Qiskit Aer simulator.

9.4.1 QSVMs on Qiskit Aer

To get started, let us just import Qiskit:

from qiskit import *

When we defined a QSVM in PennyLane, we had to ”manually” implement a kernel function in order to pass it to...

lock icon The rest of the chapter is locked
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.
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}