Training and Evaluating Quantum Kernels
Overview
Training and Evaluating Quantum Kernels
This PennyLane tutorial provides a thorough, hands-on guide to quantum kernel methods using PennyLane's kernels module, covering both how to build quantum kernels and how to make them perform well. A quantum kernel embeds classical data into quantum states through a feature map and measures the similarity between data points as the overlap (fidelity) of their encoded states; these similarities form a kernel matrix that classical algorithms such as support vector machines can use, giving a quantum-enhanced classifier. The tutorial shows how to define a feature-map circuit, compute the kernel between data points and the full kernel matrix in PennyLane, and train an SVM with it. It then goes further into making kernels effective: it introduces kernel-target alignment as a measure of how well a kernel separates classes, and demonstrates kernel training, optimizing the feature map's parameters to maximize alignment so the embedding adapts to the data. It also discusses the practical issue of noise on the kernel matrix and how to mitigate it. By combining kernel construction, evaluation, and trainable alignment, the tutorial is a comprehensive treatment of kernel-based quantum machine learning in PennyLane.
Run it
pip install -r requirements.txt
python demo.py
Source and license
Imported from demonstrations_v2/tutorial_kernels_module/demo.py in PennyLaneAI/demos at c52c0abeb5122218aa96b38eea848864cce7323f, under the Apache License 2.0. Original authors: Xanadu and the PennyLane community. The upstream LICENSE is included alongside this example.
This entry was created automatically from publicly available records. QCR links to public sources and only stores repository content where the license permits redistribution.
Versions
Cite all versions? Use the base QCR ID to always reference the latest version of this entry.
Join the Discussion
Comments (0)
No comments yet. Be the first to share your thoughts!