Reader small image

You're reading from  Dancing with Qubits - Second Edition

Product typeBook
Published inMar 2024
PublisherPackt
ISBN-139781837636754
Edition2nd Edition
Right arrow
Author (1)
Robert S. Sutor
Robert S. Sutor
author image
Robert S. Sutor

Robert S. Sutor has been a technical leader and executive in the IT industry for over 40 years. More than two decades of that were spent in IBM Research in Yorktown Heights, New York USA. During his time there, he worked on and led efforts in symbolic mathematical computation, mathematical programming languages, optimization, AI, blockchain, and quantum computing. He is the author of Dancing with Qubits: How quantum computing works and how it can change the world and Dancing with Python: Learn Python software development from scratch and get started with quantum computing, also with Packt. He is the published co-author of several research papers and the book Axiom: The Scientific Computation System with the late Richard D. Jenks. Sutor was an IBM executive on the software side of the business in areas including Java web application servers, emerging industry standards, software on Linux, mobile, and open source. He was the Vice President of Corporate Development and, later, Chief Quantum Advocate, at Infleqtion, a quantum computing and quantum sensing company based in Boulder, Colorado USA. He is currently an Adjunct Professor in the Department of Computer Science and Engineering at the University at Buffalo, New York, USA. He is a theoretical mathematician by training, has a Ph.D. from Princeton University, and an undergraduate degree from Harvard College. He started coding when he was 15 and has used most of the programming languages that have come along.
Read more about Robert S. Sutor

Right arrow

Introduction to Quantum Machine Learning

Learning is the only thing the mind never exhausts, never fears, and never regrets.

Leonardo da Vinci

It’s hard to imagine an area of computer science and data analysis that has gotten more attention and investment in recent years than AI and machine learning. While quantum computers are still not “big data” machines because of their relatively short coherence times and numbers of qubits, it is still reasonable to ask if we can extend or replace existing machine learning algorithms or computational components with quantum versions. This is the field of quantum machine learning, or QML. machine learning machine learning$quantum quantum$machine learning QML

This chapter surveys and summarizes several techniques where quantum computing might improve the performance or accuracy of neural networks and support vector machines for classification. The chapter builds on the discussion in section 1.4. algorithm$support...

Topics covered in this chapter

  1. 13.1. What is machine learning?
  2. 13.2. Methods for encoding data
    1. 13.2.1. Basis encoding
    2. 13.2.2. Amplitude encoding
    3. 13.2.3. Angle encoding
    4. 13.2.4. Dense angle encoding
  3. 13.3. Quantum neural networks
  4. 13.4. Quantum kernels for SVMs
    1. 13.4.1. Hyperplanes and feature maps
    2. 13.4.2. Norms
    3. 13.4.3. Kernels
    4. 13.4.4. Quantum kernels
  5. 13.5. Other quantum machine learning research areas
  6. 13.6. Summary

13.1 What is machine learning?

Consider my complete product browsing and purchase history with an online retailer. This data represents my experience of buying from the seller and their experience selling to me. How can the data and my new purchases help the retailer learn how to recommend and sell me additional products and services?

Machine learning is a large set of techniques where computer algorithms learn from existing data rather than having hardcoded decisions built into them. We create a model and train it from a subset of our data. If we have done a good job, this model predicts what we should do next to accomplish a goal, such as selling someone new clothes, books, or music. model

Such algorithms and models improve their accuracy as they receive new data. They might also improve when humans or processes intervene to judge the correctness and quality of predictions and results.

In unsupervised learning, an algorithm looks for patterns in the data...

13.2 Methods for encoding data

If classical computers use bits 0 and 1, but quantum computers use qubits represented as

Displayed math

for complex a and b, where |a|2 + |b|2 = 1, how do we efficiently map classical data into a multi-qubit quantum representation? We must quantum encode classical data so a quantum computer can use it.

In some instances, it may make sense to encode 0 ↦ |0⟩ and 1 ↦ |1⟩, but this would not be practical if our application involves the huge amount of information typically used in machine learning, for example. In this section, we look at several techniques for quantum-encoding classical data. There is a trade-off between being efficient with time spent encoding and decoding versus the number of qubits needed to store the information.

Suppose we have a real n-dimensional vector x. We want to represent x in an N-qubit state |ψ with Nn. We do this via an encoding circuit or unitary operator...

13.3 Quantum neural networks

Let’s recall some definitions regarding neural networks from my book Dancing with Python. 211, Section 15.8 neural network quantum$neural network node neuron

Figure 13.3 shows a neural network with three input nodes, four nodes in the hidden layer, and two output nodes. Another name for a node is a neuron. I’ve shown weights w in the network on the connections from the input nodes going to the hidden nodes, and from the hidden nodes to the output nodes. Note how the network sends the value of each node to every node in the next layer.

 Figure 13.3: Neural network with 3 inputs, 4 hidden nodes, and 2 outputs

We compute a value from the input values and weights for each node in the hidden layers. These are real numbers that we may restrict to the binary values 0 and 1. We also have an associated activation function for each node in the hidden layer, determining what value to send to...

13.4 Quantum kernels for SVMs

In section 1.4, we saw the concept of a support vector machine, or SVM, for binary classification. We mentioned kernel functions and the kernel trick to move points to a higher dimension where we can separate them with a hyperplane. An SVM is an example of a kernel machine. Let’s clarify their definitions and see where quantum may help. algorithm$support vector machine algorithm$SVM algorithm$classification kernel$trick kernel$function quantum$kernel kernel support vector machine kernel$machine

13.4.1 Hyperplanes and feature maps

A hyperplane is an n – 1 dimension linear object within an n-dimensional vector space. We assume the vector space is over R in this section. For example, a line is a hyperplane in R2, and a plane is a hyperplane in R3. Though harder to visualize, the 3-dimensional object defined with coordinates (x1, x2, x3, x4) in R4 by the equation hyperplane

Displayed math

is a hyperplane...

13.5 Other quantum machine learning research areas

In addition to quantum neural networks and kernels, researchers are investigating several other techniques. These include:

  • Quantum Born machines 53 93
  • Quantum Boltzman machines 6 155
  • Quantum convolution neural networks 48 165
  • Quantum generative adversarial networks 138 243
  • Relationships between deep learning models and kernel machines 72

13.6 Summary

This chapter introduced two quantum alternatives to classical machine learning methods: quantum neural networks and kernels. We also looked at several ways to represent classical data in quantum states.

Throughout the discussions, we returned to the same question several times: Can we show that quantum machine learning offers a significant quantum advantage compared to classical methods? The answer is a definite “maybe … one day … possibly”! In any case, “not yet” is the consensus at the time of writing. I encourage you to track the progress of quantum machine learning as quantum computers increase in size, performance, and quality. To avoid the hype, you should keep an open mind but always ask yourself honest questions about what you are trying to accomplish with what tools. 232

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Dancing with Qubits - Second Edition
Published in: Mar 2024Publisher: PacktISBN-13: 9781837636754
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

Author (1)

author image
Robert S. Sutor

Robert S. Sutor has been a technical leader and executive in the IT industry for over 40 years. More than two decades of that were spent in IBM Research in Yorktown Heights, New York USA. During his time there, he worked on and led efforts in symbolic mathematical computation, mathematical programming languages, optimization, AI, blockchain, and quantum computing. He is the author of Dancing with Qubits: How quantum computing works and how it can change the world and Dancing with Python: Learn Python software development from scratch and get started with quantum computing, also with Packt. He is the published co-author of several research papers and the book Axiom: The Scientific Computation System with the late Richard D. Jenks. Sutor was an IBM executive on the software side of the business in areas including Java web application servers, emerging industry standards, software on Linux, mobile, and open source. He was the Vice President of Corporate Development and, later, Chief Quantum Advocate, at Infleqtion, a quantum computing and quantum sensing company based in Boulder, Colorado USA. He is currently an Adjunct Professor in the Department of Computer Science and Engineering at the University at Buffalo, New York, USA. He is a theoretical mathematician by training, has a Ph.D. from Princeton University, and an undergraduate degree from Harvard College. He started coding when he was 15 and has used most of the programming languages that have come along.
Read more about Robert S. Sutor