Quantum Kernel Method#

Authors: Zirui Li, Hanrui Wang

Use Colab to run this example: https://colab.research.google.com/assets/colab-badge.svg

See this tutorial video for detailed explanations:

video

Referece: Supervised quantum machine learning models are kernel methods

Outline#

  1. Introduction to Quantum Kernel Methods.

  2. Build and train an SVM using Quantum Kernel Methods.

In this tutorial, we use tq.op_name_dict, tq.functional.func_name_dict and tq.QuantumDevice from TorchQuantum.

You can learn how to build a Quantum kernel function and train an SVM with the quantum kernel from this tutorial.

Introduction to Quantum Kernel Methods.#

Kernel Methods#

Kernels or kernel methods (also called Kernel functions) are sets of different types of algorithms that are being used for pattern analysis. They are used to solve a non-linear problem by a linear classifier. Kernels Methods are employed in SVM (Support Vector Machines) which are often used in classification and regression problems. The SVM uses what is called a “Kernel Trick” where the data is transformed and an optimal boundary is found for the possible outputs.

Quantum Kernel#

Quantum circuit can transfer the data to a high dimension Hilbert space which is hard to simulate on classical computer. Using kernel methods based on this Hilbert space can achieve unexpected performance.

How to evaluate the distance in Hilbert space?#

Assume S(x) is the unitary that transfer data x to the state in Hilbert space. To evaluate the inner product between S(x) and S(y), we add a Transpose Conjugation of S(y) behind S(x) and measure the probability that the state falls on $|00\cdots0\rangle$

conv-full-layer