ExperimentAdvancedQuantum machine learning

Kernel Comparison: Quantum, RBF and Linear

The same SVM is trained with a quantum kernel and two classical kernels (RBF, linear) on the same split; the feature-map choice can change accuracy substantially.

Goal

Compare kernels in a controlled way and understand the effect of the feature map.

Approximate duration: 10 minutes

Steps

  1. Choose Iris, features 0 and 2, and the zz map with two repetitions.
  2. Run the comparison and read the accuracy of the three kernels.
  3. Change the map to angle.
  4. Watch the mean of the off-diagonal values and their deviation.
Loading the simulator…
What theory predicts

Theory predicts that all kernels are symmetric, and that the classical kernels reach high accuracy because the task is linearly separable. The exact values depend on the split; in the engine's split with seed 2, the ZZ accuracy (reps=2) was about 73% and the angle kernel's 100%, and the RBF and linear kernels both reached 100%.

A fair comparison uses the same data, the same split and the same scaling (fitted on the training set only). In the engine's tests on Iris (setosa versus versicolor, features 0 and 2 scaled to $[0,\pi]$), the angle-encoding kernel reached a test accuracy of 100% while the ZZ kernel with two repetitions reached 73%; in other words, a more complex map is not necessarily better. This result should not be generalised to other data or settings.

The lab also shows the mean and standard deviation of the kernel's off-diagonal values: values that are close together indicate kernel concentration (Thanasilp et al. 2024). 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. Vojtěch Havlíček et al. (2019). Supervised learning with quantum-enhanced feature spaces. Nature 567:209–212 doi:10.1038/s41586-019-0980-2
  2. Maria Schuld; Alex Bocharov; Krysta M. Svore; Nathan Wiebe (2020). Circuit-centric quantum classifiers. Phys. Rev. A 101:032308 doi:10.1103/PhysRevA.101.032308
  3. Supanut Thanasilp; Samson Wang; M. Cerezo; Zoë Holmes (2024). Exponential concentration in quantum kernel methods. Nature Communications 15:5200 doi:10.1038/s41467-024-49287-w
  4. Hsin-Yuan Huang et al. (2021). Power of data in quantum machine learning. Nature Communications 12:2631 doi:10.1038/s41467-021-22539-9
  5. 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).