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.
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
LeCun, Y., Bengio, Y., Hinton, G.: Deep learning. Nature 521(7553), 436–444 (2015)
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)
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)
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)
Lecun, Y., Bottou, L., Bengio, Y., Haffner, P.: Gradient-based learning applied to document recognition. Proc. IEEE 86(11), 2278–2324 (1998)
Preskill, J.: Quantum Computing in the NISQ era and beyond. Quantum 2, 79 (2018)
Bell, J.S.: Speakable and Unspeakable in Quantum Mechanics. Cambridge University Press, Cambridege (2010)
Nielsen, M.A., Chuang, I.L.: Quantum Computation and Quantum Information. Cambridge University Press, Cambridge (2010)
Arute, F., et al.: Quantum supremacy using a programmable superconducting processor. Nature 574, 505–510 (2019)
Schuld, M.: Machine learning in quantum spaces. Nature, 179–181, (2019)
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)
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)
Biamonte, J., Wittek, P., Pancotti, N., Rebentrost, P., Wiebe, N., Lloyd, S.: Quantum machine learning. Nature 549(7671), 195–202 (2017)
Schuld, M., Killoran, N.: Quantum machine learning in feature hilbert spaces. Phys. Rev. Lett. 122(4), 040504 (2019)
Adhikary, S., Dangwal, S., Bhowmik, D.: Supervised learning with a quantum classifier using multi-level systems. Quant. Inf. Process. 19(3), 89 (2020)
Lloyd, S., Mohseni, M., Rebentrost, P.: Quantum algorithms for supervised and unsupervised machine learning. arXiv preprint arXiv:1307.0411, (2013)
Rebentrost, P., Mohseni, M., Lloyd, S.: Quantum support vector machine for big data classification. Phys. Rev. Lett. 113(13), 130503 (2014)
Lloyd, S., Weedbrook, C.: Quantum generative adversarial learning. Phys. Rev. Lett. 121(4), 040502 (2018)
Cong, I., Choi, S., Lukin, M.D.: Quantum convolutional neural networks. Nat. Phys. 15(12), 1273–1278 (2019)
Farhi, E., Goldstone, J., Gutmann, S.: A quantum approximate optimization algorithm. arXiv preprint arXiv:1411.4028, (2014)
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)
Schuld, M., Bocharov, A., Krysta, M.S., Nathan, W.: Circuit-centric quantum classifiers. Phys. Rev. A 101(3), 032308 (2020)
Marković, D., Grollier, J.: Quantum neuromorphic computing. Appl. Phys. Lett. 117(15), 150501 (2020)
Andrea, M., Bromley, T.R., Izaac, J., Schuld, M., Killoran, N.: Transfer learning in hybrid classical-quantum neural networks. Quantum 4, 340 (2019)
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)
Schuld, M., Fingerhuth, M., Petruccione, F.: Implementing a distance-based classifier with a quantum interference circuit. EPL (Europhys. Lett.) 119(6), 60002 (2017)
Bishop, C.M.: Pattern Recognition and Machine Learning. Springer, Berlin (2006)
Haykin, S.: Neural Networks and Learning Machines. Pearson Education India, (2010)
Tacchino, F., Macchiavello, C., Gerace, D., Bajoni, D.: An artificial neuron implemented on an actual quantum processor. NPJ Quant. Inf. 5, 26 (2019)
Giovannetti, V., Lloyd, S., Maccone, L.: Quantum random access memory. Phys. Rev. Lett. 100(16), 160501 (2008)
Garcia-Escartin, J.C., Chamorro-Posada, P.: Swap test and hong-ou-mandel effect are equivalent. Phys. Rev. A 87(5), 052330 (2013)
Amir-Moéz, A.R., Davis, C.: Generalized frobenius inner products. Math. Ann. 141(2), 107–112 (1960)
Chamorro-Posada, P., Garcia-Escartin, J.C.: The switch test for discriminating quantum evolutions. arXiv preprint arXiv:1706.06564, (2017)
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)
Kerenidis, I., Prakash, A.: Quantum recommendation systems. arXiv preprint arXiv:1603.08675, (2016)
Fisher, R.A.: The use of multiple measurements in taxonomic problems. Ann. Eugen. 7(2), 179–188 (1936)
Sakurai, J.J., Commins, E.D.: Modern quantum mechanics, revised edition, (1995)
Lloyd, S., Schuld, M., Ijaz, A., Izaac, J., Killoran, N.: Quantum embeddings for machine learning. arXiv preprint arXiv:2001.03622, (2020)
Johnson, J.M., Khoshgoftaar, T.M.: Survey on deep learning with class imbalance. J. Big Data 6(1), 1–54 (2019)
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)
Krawczyk, B.: Learning from imbalanced data: open challenges and future directions. Prog. Artif. Intell. 5(4), 221–232 (2016)
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)
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)
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)
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)
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)
Adhikary, S.: Entanglement assisted training algorithm for supervised quantum classifiers. Quant. Inf. Process. 20(8), 1–12 (2021)
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)
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
Corresponding author
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
About this article
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
Received:
Accepted:
Published:
DOI: https://doi.org/10.1007/s11128-022-03508-7