Tutorials
qcr:2606.58540.1

Variational Quantum Classifier with PennyLane

This PennyLane tutorial builds a variational quantum classifier, a parameterized quantum circuit trained to label data, and is one of the foundational demonstrations of quantum machine learning. The variational classifier works like a quantum analogue of a neural network: classical data is encoded into a circuit through a feature map, a trainable ansatz of parameterized gates transforms the state, and a measurement produces an output that is interpreted as a class label. The tutorial trains such a model on two classic problems, learning the parity function and classifying the Iris dataset, showing the full supervised-learning loop: encoding inputs, defining the model circuit and a bias term, choosing a cost function, and optimizing the parameters with gradient descent using PennyLane's automatic differentiation. It walks through batching the training data, monitoring accuracy on a validation set, and interpreting the learned decision boundary. By grounding quantum machine learning in concrete classification tasks with a clear train/evaluate workflow, the tutorial gives a reusable template for building and training quantum classifiers in PennyLane and is a natural next step after the basic optimization tutorials.
QML
Qubit
Circuit-based
Uploaded 3 days ago
17
Views
GitHub667
Citing this entry? Use this QCR ID
Uploaded by
QL
QCR Librarian

Overview

PennyLaneAI/demos
667238
README.md

Variational Quantum Classifier with PennyLane

This PennyLane tutorial builds a variational quantum classifier, a parameterized quantum circuit trained to label data, and is one of the foundational demonstrations of quantum machine learning. The variational classifier works like a quantum analogue of a neural network: classical data is encoded into a circuit through a feature map, a trainable ansatz of parameterized gates transforms the state, and a measurement produces an output that is interpreted as a class label. The tutorial trains such a model on two classic problems, learning the parity function and classifying the Iris dataset, showing the full supervised-learning loop: encoding inputs, defining the model circuit and a bias term, choosing a cost function, and optimizing the parameters with gradient descent using PennyLane's automatic differentiation. It walks through batching the training data, monitoring accuracy on a validation set, and interpreting the learned decision boundary. By grounding quantum machine learning in concrete classification tasks with a clear train/evaluate workflow, the tutorial gives a reusable template for building and training quantum classifiers in PennyLane and is a natural next step after the basic optimization tutorials.

Run it

pip install -r requirements.txt
python demo.py

Source and license

Imported from demonstrations_v2/tutorial_variational_classifier/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.

Join the Discussion

Comments (0)

No comments yet. Be the first to share your thoughts!

Indexed by QCR Librarian

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

v1 Latest
Jun 16, 2026
qcr:2606.58540.1

Cite all versions? Use the base QCR ID to always reference the latest version of this entry.

Tools used

PennyLane

Keywords

variational-classifier
quantum-machine-learning
pennylane
supervised-learning
classification

You may also like5