Skip to main content
Log in

Quantum average neighborhood margin maximization for feature extraction

  • Published:
Quantum Information Processing Aims and scope Submit manuscript

Abstract

Average neighborhood margin maximization (ANMM) is a local supervised metric learning approach, which aims to find projection directions where the local class discriminability is maximized. Furthermore, it has no assumption of class distribution and works well on small sample size. In this work, we address this problem in the quantum setting and present a quantum ANMM algorithm for linear feature extraction. More specifically, a quantum algorithm is designed to construct scatterness and compactness matrices in the quantum state form. Then a quantum algorithm is presented to obtain the features of the testing sample set in the quantum state form. The time complexity analysis of the quantum ANMM algorithm shows that our algorithm may achieve an exponential speedup on the dimension of the sample points \(D\), and a quadratic speedup on the numbers of training samples \(N\) and testing samples \(M\) compared to the classical counterpart under certain conditions.

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.

Institutional subscriptions

Similar content being viewed by others

Data availability statement

The data that support the findings of this study are available upon reasonable request from the authors.

References

  1. Carreira-Perpinán M.A.: A review of dimension reduction techniques. Department of Computer Science. University of Sheffield. Tech. Rep. CS-96–09 9(1–69), (1997).

  2. Roweis, S.T., Saul, L.K.: Nonlinear dimensionality reduction by locally linear embedding. Science 290(5500), 2323–2326 (2000)

    Article  ADS  Google Scholar 

  3. Wold, S., Esbensen, K., Geladi, P.: Principal component analysis. Chemometr. Intell. Lab. 2(1–3), 37–52 (1987)

    Article  Google Scholar 

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

    Article  Google Scholar 

  5. Wang F., Zhang C.: Feature extraction by maximizing the average neighborhood margin, in: 2007 IEEE Conference on Computer Vision and Pattern Recognition, IEEE, 2007, pp. 1–8.

  6. Button, K.S., Ioannidis, J.P., Mokrysz, C., Nosek, B.A., Flint, J., Robinson, E.S., Munafò, M.R.: Power failure: why small sample size undermines the reliability of neuroscience. Nat. Rev. Neur. 14(5), 365–376 (2013)

    Article  Google Scholar 

  7. Suárez-Díaz J.L., García S., Herrera F.: A tutorial on distance metric learning: mathematical foundations, algorithms, experimental analysis, prospects and challenges (with appendices on mathematical background and detailed algorithms explanation). arXiv preprint arXiv:1812.05944 (2018).

  8. Shor P.W.: Algorithms for quantum computation: discrete logarithms and factoring, in: Proceedings 35th Annual Symposium on Foundations of Computer Science, IEEE, 1994, pp. 124–134.

  9. Grover, L.K.: Quantum mechanics helps in searching for a needle in a haystack. Phys. Rev. Lett. 79(2), 325 (1997)

    Article  ADS  Google Scholar 

  10. Harrow, A.W., Hassidim, A., Lloyd, S.: Quantum algorithm for linear systems of equations. Phys. Rev. Lett. 103(15), 150502 (2009)

    Article  ADS  MathSciNet  Google Scholar 

  11. Lloyd, S., Garnerone, S., Zanardi, P.: Quantum algorithms for topological and geometric analysis of data. Nat. Comm. 7(1), 1–7 (2016)

    Article  Google Scholar 

  12. Duan, B.J., Yuan, J.B., Liu, Y., Li, D.: Quantum algorithm for support matrix machines. Phys. Rev. A 96(3), 032301 (2017)

    Article  ADS  Google Scholar 

  13. Lloyd, S., Mohseni, M., Rebentrost, P.: Quantum principal component analysis. Nat. Phys. 10(9), 631–633 (2014)

    Article  Google Scholar 

  14. Yu, C.H., Gao, F., Lin, S., Wang, J.: Quantum data compression by principal component analysis. Quan. Inf. Pro. 18(8), 1–20 (2019)

    MathSciNet  MATH  Google Scholar 

  15. He, X.: Quantum subspace alignment for domain adaptation. Phys. Rev. A 102(6), 062403 (2020)

    Article  ADS  MathSciNet  Google Scholar 

  16. He, X.: Quantum correlation alignment for unsupervised domain adaptation. Phys. Rev. A 102(3), 032410 (2020)

    Article  ADS  MathSciNet  Google Scholar 

  17. Gao, S., Pan, S.J., Yang, Y.G.: Quantum algorithm for kernelized correlation filter. Sci. China Inf. Sci. 66(2), 129501 (2023)

    Article  Google Scholar 

  18. Gao, S., Yang, Y.G.: New quantum algorithm for visual tracking. Physica A 615(2), 128587 (2023)

    Article  MathSciNet  MATH  Google Scholar 

  19. Yu, C.H., Gao, F., Wang, Q.L., Wen, Q.Y.: Quantum algorithm for association rules mining. Phys. Rev. A 94(4), 042311 (2016)

    Article  ADS  Google Scholar 

  20. Duan, B.J., Yuan, J.B., Xu, J., Li, D.: Quantum algorithm and quantum circuit for a-optimal projection: dimensionality reduction. Phys. Rev. A 99(3), 032311 (2019)

    Article  ADS  Google Scholar 

  21. He, X., Sun, L., Lyu, C., Wang, X.: Quantum locally linear embedding for nonlinear dimensionality reduction. Quan. Inf. Pro. 19(9), 1–21 (2020)

    MathSciNet  MATH  Google Scholar 

  22. Pan, S.J., Wan, L.C., Liu, H.L., Wang, Q.L., Qin, S.J., Wen, Q.Y., Gao, F.: Improved quantum algorithm for A-optimal projection. Phys. Rev. A 102(5), 052402 (2020)

    Article  ADS  MathSciNet  Google Scholar 

  23. Yu, K., Guo, G.D., Lin, S.: Quantum dimensionality reduction by linear discriminant analysis. arXiv preprint arXiv:2103.03131 (2021).

  24. Gao, S., Yang, Y.G.: A novel quantum recommender system. Phys. Scr. 98(1), 010001 (2023)

    Article  ADS  Google Scholar 

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

  26. Brandao, F.G., Svore, K.M.: Quantum speed-ups for solving semidefinite programs, in, IEEE 58th Annual Symposium on Foundations of Computer Science (FOCS). IEEE 2017, 415–426 (2017)

    Google Scholar 

  27. Wan, L.C., Yu, C.H., Pan, S.J., Gao, F., Wen, Q.Y., Qin, S.J.: Asymptotic quantum algorithm for the Toeplitz systems. Phys. Rev. A 97(6), 062322 (2018)

    Article  ADS  Google Scholar 

  28. Gao, S., Yang, Y.G.: Quantum algorithm for Toeplitz matrix-vector multiplication. Chin. Phys. B (2023). https://doi.org/10.1088/1674-1056/acb914

    Article  Google Scholar 

  29. Rebentrost, P., Schuld, M., Wossnig, L., Petruccione, F., Lloyd, S.: Quantum gradient descent and Newton’s method for constrained polynomial optimization. New J. Phys. 21(7), 073023 (2019)

    Article  ADS  MathSciNet  Google Scholar 

  30. Gao, X., Zhang, Z.Y., Duan, L.M.: A quantum machine learning algorithm based on generative models. Sci. Adv. 4(12), eaat9004 (2018)

    Article  ADS  Google Scholar 

  31. Hu, L., Wu, S.H., Cai, W., Ma, Y., Mu, X., Xu, Y., Wang, H., Song, Y., Deng, D.L., Zou, C.L.: Quantum generative adversarial learning in a superconducting quantum circuit. Sci. Adv. 5(1), eaav2761 (2019)

    Article  ADS  Google Scholar 

  32. Wang, F., Wang, X., Zhang, D., Zhang, C., Li, T.: Marginface: A novel face recognition method by average neighborhood margin maximization. Patt. Rec. 42(11), 2863–2875 (2009)

    Article  MATH  Google Scholar 

  33. Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., Blondel, M., Prettenhofer, P., Weiss, R., Dubourg, V.: Scikit-learn: Machine learning in Python. J. Mach. Learn. Res. 12, 2825–2830 (2011)

    MathSciNet  MATH  Google Scholar 

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

    Article  ADS  MathSciNet  MATH  Google Scholar 

  35. Kerenidis I., Landman J., Luongo A., Prakash A.: q-means: A quantum algorithm for unsupervised machine learning. arXiv preprint arXiv:1812.03584 (2018).

  36. Pan S.J., Wan L.C., Liu H.L., Wu Y.S., Qin S.J., Wen Q.Y., Gao F.: Quantum algorithm for Neighborhood Preserving Embedding. arXiv preprint arXiv:2110.11541 (2021).

  37. 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 

  38. Kimmel, S., Lin, C.Y.Y., Low, G.H., Ozols, M., Yoder, T.J.: Hamiltonian simulation with optimal sample complexity. npj Quan. Inf. 3(1), 1–7 (2017)

    Google Scholar 

  39. Chakraborty S., Gilyén A., Jeffery S.: The power of block-encoded matrix powers: improved regression techniques via faster Hamiltonian simulation. arXiv preprint arXiv:1804.01973 (2018).

  40. Gilyén A., Su Y., Low G.H., Wiebe N.: Quantum singular value transformation and beyond: exponential improvements for quantum matrix arithmetics, in: Proceedings of the 51st Annual ACM SIGACT Symposium on Theory of Computing, 2019, pp. 193–204.

  41. Low, G.H., Chuang, I.L.: Hamiltonian simulation by qubitization. Quantum 3, 163 (2019)

    Article  Google Scholar 

  42. Cong, I., Duan, L.M.: Quantum discriminant analysis for dimensionality reduction and classification. New J. Phys. 18(7), 073011 (2016)

    Article  ADS  MATH  Google Scholar 

Download references

Acknowledgements

We declare that we have no financial and personal relationships with other people or organizations that can inappropriately influence our work, there is no professional or other personal interest of any nature or kind in any product, service and/or company that could be construed as influencing the position presented in, or the review of, the manuscript. This work was supported by the National Natural Science Foundation of China (Grant Nos. 62071015, 62171264).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Yu-Guang Yang.

Ethics declarations

Ethical approval

Ethics Committee approval was obtained from the Institutional Ethics Committee of Beijing University of Technology to the commencement of the study.

Additional information

Publisher's Note

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

Appendices

Appendix A: quantum comparison circuit diagram

Here, we design a quantum comparison circuit used in this article, as shown in Fig. 1. Assume there are two quantum states to be compared, \(\left|a\right.\rangle =|{a}_{l-1}{a}_{l-2}\cdots {a}_{0}\rangle \) and \(\left|b\right.\rangle =|{b}_{l-1}{b}_{l-2}\cdots {b}_{0}\rangle \), after passing this quantum comparison circuit, if \(a\ge b\), we can obtain \(|0\rangle \) in the lower most register, otherwise, this quantum state will be flipped to \(|1\rangle \).

Fig. 1
figure 1

Quantum comparison circuit

Appendix B: Proof of Eq. (22)

According to the Hadamard Lemma [38], we can get

$${\mathrm{e}}^{-\mathrm{i}\rho \Delta t}\sigma {\mathrm{e}}^{\mathrm{i}\rho \Delta t}=\sigma -i\Delta t\left[\rho ,\sigma \right]-\frac{\Delta{t}^{2}}{2}\left[\rho ,\left[\rho ,\sigma \right]\right]+\cdots .$$
(38)

As for \({\mathrm{Tr}}_{p}\left\{{\mathrm{e}}^{-\mathrm{i}Sw\Delta t}\left(\sigma \otimes \rho \right){e}^{iSw\Delta t}\right\}\), suppose \(\sigma ={\sum }_{i}{\sigma }_{i}|{\sigma }_{i}\rangle \langle {\sigma }_{i}|\) and \(\rho ={\sum }_{j}{\rho }_{j}|{\rho }_{j}\rangle \langle {\rho }_{j}|\), the derivation is as follows:

$$\begin{array}{l}{\mathrm{Tr}}_{p}\left\{{\mathrm{e}}^{-\mathrm{i}Sw\Delta t}\left(\sigma \otimes \rho \right){e}^{iSw\Delta t}\right\}\\ ={\mathrm{Tr}}_{p}\left\{\left(\sigma \otimes \rho \right)+\frac{{\left(-\mathrm{i}Sw\Delta t\right)}^{1}}{1!}\left(\sigma \otimes \rho \right)+\left(\sigma \otimes \rho \right)\frac{{\left(\mathrm{i}Sw\Delta t\right)}^{1}}{1!}+\mathcal{O}\left(\Delta{t}^{2}\right)\right\}\\ ={\mathrm{Tr}}_{p}\left\{{\sum }_{ij}{\sigma }_{i}{\rho }_{j}|{\sigma }_{i}\rangle \langle {\sigma }_{i}||{\rho }_{j}\rangle \langle {\rho }_{j}|-\mathrm{i}Sw\Delta t{\sum }_{ij}{\sigma }_{i}{\rho }_{j}|{\sigma }_{i}\rangle \langle {\sigma }_{i}||{\rho }_{j}\rangle \langle {\rho }_{j}|+{\sum }_{ij}{\sigma }_{i}{\rho }_{j}|{\sigma }_{i}\rangle \langle {\sigma }_{i}||{\rho }_{j}\rangle \langle {\rho }_{j}|\left(\mathrm{i}Sw\Delta t\right)+\mathcal{O}\left(\Delta{t}^{2}\right)\right\}\\ ={\mathrm{Tr}}_{p}\left\{{\sum }_{ij}{\sigma }_{i}{\rho }_{j}|{\sigma }_{i}\rangle \langle {\sigma }_{i}||{\rho }_{j}\rangle \langle {\rho }_{j}|-\mathrm{i}\Delta t{\sum }_{ij}{\sigma }_{i}{\rho }_{j}|{\rho }_{i}\rangle \langle {\sigma }_{i}||{\sigma }_{j}\rangle \langle {\rho }_{j}|+{\sum }_{ij}{\sigma }_{i}{\rho }_{j}|{\sigma }_{i}\rangle \langle {\rho }_{i}||{\rho }_{j}\rangle \langle {\sigma }_{j}|\left(\mathrm{i}\Delta t\right)+\mathcal{O}\left(\Delta{t}^{2}\right)\right\}\\ ={\sum }_{i}|{\sigma }_{i}\rangle \langle {\sigma }_{i}|-\mathrm{i}\Delta t{\sum }_{ij}{\sigma }_{i}{\rho }_{j}|{\rho }_{i}\rangle \langle {\sigma }_{i}|\langle {\rho }_{j}||{\sigma }_{j}\rangle +{\sum }_{ij}{\sigma }_{i}{\rho }_{j}|{\sigma }_{i}\rangle \langle {\rho }_{i}|\langle {\sigma }_{j}||{\rho }_{j}\rangle \left(\mathrm{i}\Delta t\right)+\mathcal{O}\left(\Delta{t}^{2}\right)\\ =\sigma -\mathrm{i}\Delta t\left[\rho ,\sigma \right]+\mathcal{O}\left(\Delta{t}^{2}\right).\end{array}$$
(39)

Appendix C: Proof of Eq. (23)

$$\begin{array}{c}{\mathrm{Tr}}_{p}\left\{\left({\sum }_{n}|n\Delta t\rangle \langle n\Delta t|\otimes \prod_{i=1}^{n}{\mathrm{e}}^{-\mathrm{i}S{w}_{i}\Delta t}\right)\left({\sum }_{n}|n\Delta t\rangle \langle n\Delta t|\otimes \sigma {\left(\otimes \rho \right)}^{n}\right)\left({\sum }_{n}|n\Delta t\rangle \langle n\Delta t|\otimes \prod_{i=1}^{n}{\mathrm{e}}^{\mathrm{i}S{w}_{i}\Delta t}\right)\right\}\\ ={\mathrm{Tr}}_{p}\left\{{\sum }_{n}|n\Delta t\rangle \langle n\Delta t|\otimes \prod_{i=}^{n}{\mathrm{e}}^{-\mathrm{i}S{w}_{i}\Delta t}\left(\sigma {\left(\otimes \rho \right)}^{n}\right)\prod_{i=1}^{n}{\mathrm{e}}^{\mathrm{i}S{w}_{i}\Delta t}\right\}\\ ={\mathrm{Tr}}_{p}\left\{{\sum }_{n}|n\Delta t\rangle \langle n\Delta t|\otimes \left(\prod_{i=2}^{n}{\mathrm{e}}^{-\mathrm{i}S{w}_{i}\Delta t}\left(\begin{array}{c}\sigma \otimes \rho -\mathrm{i}S{w}_{1}\Delta t\left(\sigma \otimes \rho \right)\\ +\left(\sigma \otimes \rho \right)\mathrm{i}S{w}_{1}\Delta t\end{array}\right){\left(\otimes \rho \right)}^{n-1}\prod_{i=2}^{n}{\mathrm{e}}^{\mathrm{i}S{w}_{i}\Delta t}+\mathcal{O}\left(\Delta{t}^{2}\right)\right)\right\}\\ ={\mathrm{Tr}}_{p}\left\{{\sum }_{n}|n\Delta t\rangle \langle n\Delta t|\otimes \left(\prod_{i=3}^{n}{\mathrm{e}}^{-\mathrm{i}S{w}_{i}\Delta t}\left(\begin{array}{c}\sigma \otimes \rho \otimes \rho \\ -\mathrm{i}S{w}_{2}\Delta t\left(\sigma \otimes \rho \otimes \rho \right)\\ +\left(\sigma \otimes \rho \otimes \rho \right)\mathrm{i}S{w}_{2}\Delta t\\ -\mathrm{i}S{w}_{1}\Delta t\left(\sigma \otimes \rho \otimes \rho \right)\\ +\left(\sigma \otimes \rho \otimes \rho \right)\mathrm{i}S{w}_{1}\Delta t\end{array}\right){\left(\otimes \rho \right)}^{n-2}\prod_{i=3}^{n}{\mathrm{e}}^{\mathrm{i}S{w}_{i}\Delta t}+\mathcal{O}\left(\Delta{t}^{2}\right)\right)\right\}\\ ={\mathrm{Tr}}_{p}\left\{{\sum }_{n}|n\Delta t\rangle \langle n\Delta t|\otimes \left(\sigma {\left(\otimes \rho \right)}^{n}-\mathrm{i}\Delta t{\sum }_{n}S{w}_{i}\left(\sigma {\left(\otimes \rho \right)}^{n}\right)-\left(\sigma {\left(\otimes \rho \right)}^{n}\right)S{w}_{i}+\mathcal{O}\left(\Delta{t}^{2}\right)\right)\right\}\\ ={\sum }_{n}|n\Delta t\rangle \langle n\Delta t|\otimes \left(\sigma -\mathrm{i}\Delta tn\left[\rho ,\sigma \right]+\mathcal{O}\left(\Delta{t}^{2}\right)\right)\\ \approx {\sum }_{n}|n\Delta t\rangle \langle n\Delta t|\otimes {\mathrm{e}}^{-\mathrm{i}\rho n\Delta t}\sigma {\mathrm{e}}^{\mathrm{i}\rho n\Delta t},\end{array}$$
(40)

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Gao, S., Pan, SJ., Xu, GB. et al. Quantum average neighborhood margin maximization for feature extraction. Quantum Inf Process 22, 152 (2023). https://doi.org/10.1007/s11128-023-03879-5

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s11128-023-03879-5

Keywords

Navigation