Skip to main content
Log in

Fast-QTrain: an algorithm for fast training of variational classifiers

  • Published:
Quantum Information Processing Aims and scope Submit manuscript

Abstract

This work proposes a novel algorithm (Fast-QTrain) that enables fast training of variational classifiers. This training speedup is achieved by processing multiple samples, from a classical data set, in parallel during the training process. The proposed algorithm utilizes a quantum RAM along with other quantum circuits for implementing the forward pass. Besides, instead of computing the loss classically, which is the usual practice, we calculate the loss here using a swap test circuit. As a result, our algorithm reduces the training cost of a variational classifier trained for m epochs from the usual \(\mathcal {O}(mN)\) (which is also the case with most classical machine learning algorithms) to \(\mathcal {O}(N + m\log N)\) where the data set contains N samples. Ignoring the one-time overhead of loading the N training samples into the qRAM, the time complexity per epoch of training is \(\mathcal {O}(\log N)\) in our proposed algorithm, as opposed to \(\mathcal {O}(N)\) (which is the case for other variational algorithms and most classical machine learning algorithms). By performing quantum-circuit simulations on the Pennylane package, we show fairly accurate training using our proposed algorithm on a popular, classical data set: Fisher’s Iris data set of flowers. While we restrict ourselves to binary classification (of samples from classical data sets) in this paper, our algorithm can be easily generalized to carry out multi-class classification. Our proposed algorithm (Fast-QTrain) can also be adapted for any classification ansatz used in the variational circuit as long as the encoding of the classical data into qubits is non-parameterized.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6

Similar content being viewed by others

Data availability

Data from publicly available machine learning data sets like the Fisher’s Iris data set have been used here to train and characterize our proposed algorithm. The data set can be found at: https://archive.ics.uci.edu/ml/datasets/iris Our Python codes that implement the proposed algorithm can be made available upon requests sent to the email IDs of the authors (mentioned at the top of the manuscript).

References

  1. LeCun, Y., Bengio, Y., Hinton, G.: Deep learning. Nature 521(7553), 436–444 (2015)

    Article  ADS  Google Scholar 

  2. Mikolov, T., Sutskever, I., Chen, K., Corrado, G.S., Dean J.: Distributed representations of words and phrases and their compositionality. In Advances in neural information processing systems, pp. 3111–3119, (2013)

  3. Schmidt, J., Marques, M.R.G., Botti, S., Marques, M.A.L.: Recent advances and applications of machine learning in solid-state materials science. NPJ Comput. Mater. 5(1), 1–36 (2019)

    Article  Google Scholar 

  4. Wernick, M.N., Yang, Y., Brankov, J.G., Yourganov, G., Strother, S.C.: Machine learning in medical imaging. IEEE Signal Process. Mag. 27(4), 25–38 (2010)

    Article  ADS  Google Scholar 

  5. Lecun, Y., Bottou, L., Bengio, Y., Haffner, P.: Gradient-based learning applied to document recognition. Proc. IEEE 86(11), 2278–2324 (1998)

    Article  Google Scholar 

  6. Preskill, J.: Quantum Computing in the NISQ era and beyond. Quantum 2, 79 (2018)

    Article  Google Scholar 

  7. Bell, J.S.: Speakable and Unspeakable in Quantum Mechanics. Cambridge University Press, Cambridege (2010)

    MATH  Google Scholar 

  8. Nielsen, M.A., Chuang, I.L.: Quantum Computation and Quantum Information. Cambridge University Press, Cambridge (2010)

    Book  Google Scholar 

  9. Arute, F., et al.: Quantum supremacy using a programmable superconducting processor. Nature 574, 505–510 (2019)

    Article  ADS  Google Scholar 

  10. Schuld, M.: Machine learning in quantum spaces. Nature, 179–181, (2019)

  11. Ramezani, S.B., Sommers, A., Manchukonda, H.K., Rahimi, S., Amirlatifi, A.: Machine learning algorithms in quantum computing: a survey. In Proceedings of the International Joint Conference on Neural Networks (IJCNN), (2020)

  12. Perdomo-Ortiz, A., Benedetti, M., Realpe-Gómez, J., Biswas, R.: Opportunities and challenges for quantum-assisted machine learning in near-term quantum computers. Quant. Sci. Technol. 3(030502), 1–13 (2018)

    Google Scholar 

  13. Biamonte, J., Wittek, P., Pancotti, N., Rebentrost, P., Wiebe, N., Lloyd, S.: Quantum machine learning. Nature 549(7671), 195–202 (2017)

    Article  ADS  Google Scholar 

  14. Schuld, M., Killoran, N.: Quantum machine learning in feature hilbert spaces. Phys. Rev. Lett. 122(4), 040504 (2019)

    Article  ADS  Google Scholar 

  15. Adhikary, S., Dangwal, S., Bhowmik, D.: Supervised learning with a quantum classifier using multi-level systems. Quant. Inf. Process. 19(3), 89 (2020)

    Article  ADS  MathSciNet  Google Scholar 

  16. Lloyd, S., Mohseni, M., Rebentrost, P.: Quantum algorithms for supervised and unsupervised machine learning. arXiv preprint arXiv:1307.0411, (2013)

  17. Rebentrost, P., Mohseni, M., Lloyd, S.: Quantum support vector machine for big data classification. Phys. Rev. Lett. 113(13), 130503 (2014)

    Article  ADS  Google Scholar 

  18. Lloyd, S., Weedbrook, C.: Quantum generative adversarial learning. Phys. Rev. Lett. 121(4), 040502 (2018)

    Article  ADS  MathSciNet  Google Scholar 

  19. Cong, I., Choi, S., Lukin, M.D.: Quantum convolutional neural networks. Nat. Phys. 15(12), 1273–1278 (2019)

    Article  Google Scholar 

  20. Farhi, E., Goldstone, J., Gutmann, S.: A quantum approximate optimization algorithm. arXiv preprint arXiv:1411.4028, (2014)

  21. Peruzzo, A., McClean, J., Shadbolt, P., Yung, M.-H., Zhou, X.-Q., Love, P.J., Aspuru-Guzik, A., O brien, J.L.: A variational eigenvalue solver on a photonic quantum processor. Nat. Commun. 5, 4213 (2014)

    Article  ADS  Google Scholar 

  22. Schuld, M., Bocharov, A., Krysta, M.S., Nathan, W.: Circuit-centric quantum classifiers. Phys. Rev. A 101(3), 032308 (2020)

    Article  ADS  MathSciNet  Google Scholar 

  23. Marković, D., Grollier, J.: Quantum neuromorphic computing. Appl. Phys. Lett. 117(15), 150501 (2020)

    Article  ADS  Google Scholar 

  24. Andrea, M., Bromley, T.R., Izaac, J., Schuld, M., Killoran, N.: Transfer learning in hybrid classical-quantum neural networks. Quantum 4, 340 (2019)

    Google Scholar 

  25. Havlíček, V., Córcoles, A.D., Temme, K., Harrow, A.W., Kandala, A., Chow, J.M., Gambetta, J.M.: Supervised learning with quantum-enhanced feature spaces. Nature 567(7747), 209–212 (2019)

    Article  ADS  Google Scholar 

  26. Schuld, M., Fingerhuth, M., Petruccione, F.: Implementing a distance-based classifier with a quantum interference circuit. EPL (Europhys. Lett.) 119(6), 60002 (2017)

    Article  ADS  Google Scholar 

  27. Bishop, C.M.: Pattern Recognition and Machine Learning. Springer, Berlin (2006)

    MATH  Google Scholar 

  28. Haykin, S.: Neural Networks and Learning Machines. Pearson Education India, (2010)

  29. Tacchino, F., Macchiavello, C., Gerace, D., Bajoni, D.: An artificial neuron implemented on an actual quantum processor. NPJ Quant. Inf. 5, 26 (2019)

    Article  ADS  Google Scholar 

  30. Giovannetti, V., Lloyd, S., Maccone, L.: Quantum random access memory. Phys. Rev. Lett. 100(16), 160501 (2008)

    Article  ADS  MathSciNet  Google Scholar 

  31. Garcia-Escartin, J.C., Chamorro-Posada, P.: Swap test and hong-ou-mandel effect are equivalent. Phys. Rev. A 87(5), 052330 (2013)

    Article  ADS  Google Scholar 

  32. Amir-Moéz, A.R., Davis, C.: Generalized frobenius inner products. Math. Ann. 141(2), 107–112 (1960)

    Article  MathSciNet  Google Scholar 

  33. Chamorro-Posada, P., Garcia-Escartin, J.C.: The switch test for discriminating quantum evolutions. arXiv preprint arXiv:1706.06564, (2017)

  34. Cao, S., Wossnig, L., Vlastakis, B., Leek, P., Grant, E.: Cost-function embedding and dataset encoding for machine learning with parametrized quantum circuits. Phys. Rev. A 101(5), 052309 (2020)

    Article  ADS  Google Scholar 

  35. Kerenidis, I., Prakash, A.: Quantum recommendation systems. arXiv preprint arXiv:1603.08675, (2016)

  36. Fisher, R.A.: The use of multiple measurements in taxonomic problems. Ann. Eugen. 7(2), 179–188 (1936)

    Article  Google Scholar 

  37. Sakurai, J.J., Commins, E.D.: Modern quantum mechanics, revised edition, (1995)

  38. Lloyd, S., Schuld, M., Ijaz, A., Izaac, J., Killoran, N.: Quantum embeddings for machine learning. arXiv preprint arXiv:2001.03622, (2020)

  39. Johnson, J.M., Khoshgoftaar, T.M.: Survey on deep learning with class imbalance. J. Big Data 6(1), 1–54 (2019)

    Article  Google Scholar 

  40. Fernández, A., Garcia, S., Herrera, F., Chawla, N.V.: Smote for learning from imbalanced data: progress and challenges, marking the 15-year anniversary. J. Artif. Intell. Res. 61, 863–905 (2018)

    Article  MathSciNet  Google Scholar 

  41. Krawczyk, B.: Learning from imbalanced data: open challenges and future directions. Prog. Artif. Intell. 5(4), 221–232 (2016)

    Article  Google Scholar 

  42. Hann, C.T., Zou, C.-L., Zhang, Y., Chu, Y., Schoelkopf, R.J., Girvin, S.M., Jiang, L.: Hardware-efficient quantum random access memory with hybrid quantum acoustic systems. Phys. Rev. Lett. 123, 250501 (2019)

    Article  ADS  Google Scholar 

  43. Havlíček, V., Córcoles, A., Temme, K., Harrow, A.W., Kandala, A., Chow, J.M., Gambetta, J.M.: Supervised learning with quantum-enhanced feature spaces. Nature 567(1), 209–212 (2019)

    Article  ADS  Google Scholar 

  44. Gokhale, P., Ding, Y., Propson, T., Winkler, C., Leung, N., Shi, Y, Schuster, D.I., Hoffmann, H., Chong, F.T.: Partial compilation of variational algorithms for noisy intermediate-scale quantum machines. Micro, (2019)

  45. Gokhale, P., Angiuli, O., Ding, Y., Gui, K., Tomesh, M., Suchara, T., Margaret, M., Chong, F.T.: Optimization of simultaneous measurement for variational quantum eigensolver applications. IEEE International conference on quantum computing and engineering (QCE), (2020)

  46. Kumar, S., Dangwal, S., Adhikary, S., Bhowmik, D.: A quantum activation function for neural networks: proposal and implementation. In 2021 International joint conference on neural networks (IJCNN), pp. 1–8. IEEE, (2021)

  47. Adhikary, S.: Entanglement assisted training algorithm for supervised quantum classifiers. Quant. Inf. Process. 20(8), 1–12 (2021)

    Article  MathSciNet  Google Scholar 

  48. McClean, J.R., Romero, J., Babbush, R., Aspuru-Guzik, A.: The theory of variational hybrid quantum-classical algorithms. New J. Phys. 18(2), 023023 (2016)

    Article  ADS  Google Scholar 

Download references

Acknowledgements

The authors thank Tanvi Verma for going through the manuscript at an earlier stage of the work and making valuable suggestions. The authors also thank Soumik Adhikary, Saurabh Kumar, and R. Vijayaraghavan for insightful discussions regarding quantum computing and quantum machine learning, which led to the conceptualization of this work.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Debanjan Bhowmik.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Dangwal, S., Sharma, R. & Bhowmik, D. Fast-QTrain: an algorithm for fast training of variational classifiers. Quantum Inf Process 21, 189 (2022). https://doi.org/10.1007/s11128-022-03508-7

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s11128-022-03508-7

Keywords

Navigation