ExperimentIntermediateQuantum machine learning

Iris Classification with a VQC

A two-qubit VQC is trained on two Iris features (versicolor vs virginica), a harder task because the classes partly overlap.

Goal

Apply a quantum classifier to small real data and interpret the results honestly.

Approximate duration: 8 minutes

Steps

  1. Choose classes 1 and 2 and features 2 and 3.
  2. Train for 30 epochs.
  3. Read the confusion matrix.
  4. Compare with the classical baseline.
Loading the simulator…
What theory predicts

Theory predicts that the loss decreases and that some errors remain in the region where the two classes overlap, so 100% accuracy is not expected. The actual numbers depend on the split and the seed, and do not count as evidence of a quantum advantage.

The Iris data (Fisher 1936) contain 150 flowers from three classes with four features. The setosa class is linearly separable from the other two, while versicolor and virginica partly overlap, so no classifier is expected to reach perfect accuracy on just two features. We chose petal length and width (features 2 and 3) because they are the most discriminative.

Each vector is converted to two angles after scaling to $[0,\pi]$ using the training data only, and the model is then trained as in the VQC experiment. Simulation results on small datasets do not prove any quantum advantage over classical machine learning.

Test your understanding

The quiz needs JavaScript.

Related topics

References

  1. R. A. Fisher (1936). The use of multiple measurements in taxonomic problems. Annals of Eugenics 7(2):179–188 doi:10.1111/j.1469-1809.1936.tb02137.x
  2. R. A. Fisher (1936). Iris (UCI Machine Learning Repository). UCI Machine Learning Repository archive.ics.uci.eduThe data is embedded as in scikit-learn load_iris (150 samples).
  3. Maria Schuld; Francesco Petruccione (2021). Machine Learning with Quantum Computers. Springer (Quantum Science and Technology) doi:10.1007/978-3-030-83098-4
  4. Xanadu (2025). What is quantum machine learning?. PennyLane pennylane.ai