# Coreset Clustering on Small Quantum Computers

^{1}

^{2}

^{3}

^{4}

^{*}

## Abstract

**:**

## 1. Introduction

Algorithm 1: 2-means clustering via coresets+QAOA. |

Input : A data set ${\mathit{x}}_{1},...,{\mathit{x}}_{n}\in {\mathbb{R}}^{d}$Output : Cluster centers ${\mathit{\mu}}_{-1}$ and ${\mathit{\mu}}_{+1}$ which approximately minimize
$$\sum _{i\in \left[n\right]}\underset{j\in \{-1,+1\}}{min}{\u2225{\mathit{x}}_{i}-{\mathit{\mu}}_{j}\u2225}^{2}$$
Algorithm: 1. Construct a coreset $({\mathit{X}}^{\prime},w)$ of size m. 2. Construct a jth order m-qubit Hamiltonian for the coreset. 3. Use QAOA to variationally approximate an energy-maximizing eigenstate of the Hamiltonian. 4. Treat the 0/1 assignment of the eigenstate as the $k=2$ clustering. |

- We implemented algorithms for coresets and evaluated their performance on real data sets.
- We cast coreset clustering to a Hamiltonian optimization problem that can be solved with QAOA, and herein we demonstrate how to break past the assumption of equal cluster weights.
- We benchmarked the performance of Algorithm 1 across six different data sets, including real and synthetic data, comparing the 2-means clusterings found by quantum and classical means. We found that some data sets are better suited to coreset summarization than others, which can play a large role in the quality of the clustering solutions.

## 2. $\mathit{k}$-Means Clustering

## 3. Coresets for $\mathit{k}$-Means

## 4. Coreset $\mathit{k}$-Means via QAOA

#### 4.1. QAOA

#### 4.2. Hamiltonians for k-Means Clustering: Equal Cluster Weights

#### 4.3. Hamiltonians for k-Means: Unequal Cluster Weights

## 5. Results

#### 5.1. Data Sets

#### 5.2. Evaluation Methodology

Data Set | Description |
---|---|

CIFAR-10 | 10,000 images (32 × 32 pixels) from CIFAR-10 data set [28]. 1000 images per category. |

COCO | 5000 images from Common Objects in Context validation data set [29]. Images translated into feature vectors of dimension 512. |

Epilepsy | Epileptic seizure recognition data set from [30]. 11,500 vectors of dimension 179. |

Pulsars | Pulsar candidates from HTRU2 data set [31]. 1600/17,900 of 9-dimensional feature vectors are pulsars. |

Yeast | Localization sites of proteins [32]. 1500 8-dimensional vectors. |

Synthetic | 40,000 512-dimensional points drawn from 11 random Gaussian clusters. Ten clusters contribute 5 points each, last cluster has majority. |

#### 5.3. Coreset and QAOA Bound Results

#### 5.4. Experimental QAOA Results

## 6. Discussion and Conclusions

## Author Contributions

## Funding

## Data Availability Statement

## Conflicts of Interest

## References

- Murali, P.; Linke, N.M.; Martonosi, M.; Abhari, A.J.; Nguyen, N.H.; Alderete, C.H. Full-stack, real-system quantum computer studies: Architectural comparisons and design insights. In Proceedings of the 46th International Symposium on Computer Architecture, Phoenix, AZ, USA, 22–26 June 2019; pp. 527–540. [Google Scholar]
- Pino, J.; Dreiling, J.; Figgatt, C.; Gaebler, J.; Moses, S.; Baldwin, C.; Foss-Feig, M.; Hayes, D.; Mayer, K.; Ryan-Anderson, C.; et al. Demonstration of the QCCD trapped-ion quantum computer architecture. arXiv
**2020**, arXiv:2003.01293. [Google Scholar] - Watson, T.; Philips, S.; Kawakami, E.; Ward, D.; Scarlino, P.; Veldhorst, M.; Savage, D.; Lagally, M.; Friesen, M.; Coppersmith, S.; et al. A programmable two-qubit quantum processor in silicon. Nature
**2018**, 555, 633–637. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Arute, F.; Arya, K.; Babbush, R.; Bacon, D.; Bardin, J.C.; Barends, R.; Biswas, R.; Boixo, S.; Brandao, F.G.; Buell, D.A.; et al. Quantum supremacy using a programmable superconducting processor. Nature
**2019**, 574, 505–510. [Google Scholar] [CrossRef] [Green Version] - Harrow, A.W.; Hassidim, A.; Lloyd, S. Quantum algorithm for linear systems of equations. Phys. Rev. Lett.
**2009**, 103, 150502. [Google Scholar] [CrossRef] [PubMed] - Grover, L.K. A fast quantum mechanical algorithm for database search. In Proceedings of the Twenty-Eighth Annual ACM Symposium on Theory of Computing, Philadelphia, PA, USA, 22–24 May 1996; pp. 212–219. [Google Scholar]
- Giovannetti, V.; Lloyd, S.; Maccone, L. Quantum random access memory. Phys. Rev. Lett.
**2008**, 100, 160501. [Google Scholar] [CrossRef] [Green Version] - Arunachalam, S.; Gheorghiu, V.; Jochym-O’Connor, T.; Mosca, M.; Srinivasan, P.V. On the robustness of bucket brigade quantum RAM. New J. Phys.
**2015**, 17, 123010. [Google Scholar] [CrossRef] - Harrow, A.W. Small quantum computers and large classical data sets. arXiv
**2020**, arXiv:2004.00026. [Google Scholar] - Bachem, O.; Lucic, M.; Krause, A. Practical coreset constructions for machine learning. arXiv
**2017**, arXiv:1703.06476. [Google Scholar] - Huggins, J.; Campbell, T.; Broderick, T. Coresets for scalable Bayesian logistic regression. In Proceedings of the 30th International Conference on Neural Information Processing Systems, Barcelona, Spain, 5–10 December 2016; pp. 4087–4095. [Google Scholar]
- Campbell, T.; Broderick, T. Bayesian coreset construction via greedy iterative geodesic ascent. arXiv
**2018**, arXiv:1802.01737. [Google Scholar] - Regev, O.; Schiff, L. Impossibility of a quantum speed-up with a faulty oracle. In Proceedings of the International Colloquium on Automata, Languages, and Programming, Reykjavik, Iceland, 7–11 July 2008; Springer: Berlin/Heidelberg, Germany, 2008; pp. 773–781. [Google Scholar]
- Farhi, E.; Goldstone, J.; Gutmann, S. A Quantum Approximate Optimization Algorithm. arXiv
**2014**, arXiv:1411.4028. [Google Scholar] - Bishop, C.M. Pattern Recognition and Machine Learning; Springer: Berlin/Heidelberg, Germany, 2006. [Google Scholar]
- Lloyd, S. Least squares quantization in PCM. IEEE Trans. Inf. Theory
**1982**, 28, 129–137. [Google Scholar] [CrossRef] - Arthur, D.; Vassilvitskii, S. k-Means++: The Advantages of Careful Seeding. In Proceedings of the Eighteenth Annual ACM-SIAM Symposium on Discrete Algorithms, New Orleans, LA, USA, 7–9 January 2007; pp. 1027–1035. [Google Scholar]
- Garey, M.; Johnson, D.; Witsenhausen, H. The complexity of the generalized Lloyd-max problem (corresp.). IEEE Trans. Inf. Theory
**1982**, 28, 255–256. [Google Scholar] [CrossRef] - Braverman, V.; Feldman, D.; Lang, H. New frameworks for offline and streaming coreset constructions. arXiv
**2016**, arXiv:1612.00889. [Google Scholar] - Farhi, E.; Goldstone, J.; Gutmann, S.; Sipser, M. Quantum computation by adiabatic evolution. arXiv
**2000**, arXiv:quant-ph/0001106. [Google Scholar] - Otterbach, J.; Manenti, R.; Alidoust, N.; Bestwick, A.; Block, M.; Bloom, B.; Caldwell, S.; Didier, N.; Fried, E.S.; Hong, S.; et al. Unsupervised machine learning on a hybrid quantum computer. arXiv
**2017**, arXiv:1712.05771. [Google Scholar] - Dua, D.; Graff, C. UCI Machine Learning Repository. Irvine, CA: University of California, School of Information and Computer Science. 2019. Available online: http://archive.ics.uci.edu/ml (accessed on 27 April 2020).
- Safka, C. img2vec: Use Pre-Trained Models in PyTorch to Extract Vector Embeddings for Any Image. 2019. Available online: https://github.com/christiansafka/img2vec/ (accessed on 23 April 2020).
- He, K.; Zhang, X.; Ren, S.; Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2016; pp. 770–778. [Google Scholar]
- Deng, J.; Dong, W.; Socher, R.; Li, L.J.; Li, K.; Fei-Fei, L. Imagenet: A large-scale hierarchical image database. In Proceedings of the 2009 IEEE Conference on Computer Vision and Pattern Recognition, Miami, FL, USA, 20–25 June 2009; pp. 248–255. [Google Scholar]
- Pedregosa, F.; Varoquaux, G.; Gramfort, A.; Michel, V.; Thirion, B.; Grisel, O.; Blondel, M.; Prettenhofer, P.; Weiss, R.; Dubourg, V.; et al. Scikit-learn: Machine learning in Python. J. Mach. Learn. Res.
**2011**, 12, 2825–2830. [Google Scholar] - Ralambondrainy, H. A conceptual version of the K-means algorithm. Pattern Recognit. Lett.
**1995**, 16, 1147–1157. [Google Scholar] [CrossRef] - Krizhevsky, A.; Hinton, G. Learning Multiple Layers of Features from Tiny Images. Master’s Thesis, Department of Computer Science, University of Toronto, Toronto, ON, Canada, 2009. [Google Scholar]
- Lin, T.Y.; Maire, M.; Belongie, S.; Hays, J.; Perona, P.; Ramanan, D.; Dollár, P.; Zitnick, C.L. Microsoft coco: Common objects in context. In Proceedings of the European Conference on Computer Vision, Zurich, Switzerland, 6–12 September 2014; Springer: Cham, Switzerland, 2014; pp. 740–755. [Google Scholar]
- Andrzejak, R.G.; Lehnertz, K.; Mormann, F.; Rieke, C.; David, P.; Elger, C.E. Indications of nonlinear deterministic and finite-dimensional structures in time series of brain electrical activity: Dependence on recording region and brain state. Phys. Rev. E
**2001**, 64, 061907. [Google Scholar] [CrossRef] [Green Version] - Lyon, R.J.; Stappers, B.; Cooper, S.; Brooke, J.; Knowles, J. Fifty years of pulsar candidate selection: From simple filters to a new principled real-time classification approach. Mon. Not. R. Astron. Soc.
**2016**, 459, 1104–1123. [Google Scholar] [CrossRef] [Green Version] - Horton, P.; Nakai, K. A probabilistic classification system for predicting the cellular localization sites of proteins. In Proceedings of the Ismb, St. Louis, MO, USA, 12–15 June 1996; Volume 4, pp. 109–115. [Google Scholar]
- Kivlichan, I.D.; McClean, J.; Wiebe, N.; Gidney, C.; Aspuru-Guzik, A.; Chan, G.K.L.; Babbush, R. Quantum simulation of electronic structure with linear depth and connectivity. Phys. Rev. Lett.
**2018**, 120, 110501. [Google Scholar] [CrossRef] [Green Version] - O’Gorman, B.; Huggins, W.J.; Rieffel, E.G.; Whaley, K.B. Generalized swap networks for near-term quantum computing. arXiv
**2019**, arXiv:1905.05118. [Google Scholar] - Crooks, G.E. Performance of the quantum approximate optimization algorithm on the maximum cut problem. arXiv
**2018**, arXiv:1811.08419. [Google Scholar] - Farhi, E.; Gamarnik, D.; Gutmann, S. The Quantum Approximate Optimization Algorithm Needs to See the Whole Graph: A Typical Case. arXiv
**2020**, arXiv:2004.09002. [Google Scholar]

**Figure 1.**Weighted Max-Cut for a coreset consisting of five points. Given an assignment of vertices to two colors, i.e., a cut, we are interested in the sum of $-{w}_{i}{w}_{j}{\mathit{x}}_{i}\xb7{\mathit{x}}_{j}$ on edges crossing the cut. By interpreting these terms as edge weights, we seek a weighted Max-Cut.

**Figure 3.**Evaluation of quantum and classical coreset clustering on six different data sets. The green and orange bars were obtained by running classical 2-means on $m=5,10,15,$ and 20 random and BFL16 coresets, respectively. The blue bars express the cost of the highest-eigenstate of the $m=5$ and 10 Hamiltonians using a j-th order Taylor expansion. These can be interpreted as bounds on QAOA’s performance with m qubits. We report the best of 10 results for all data sets, except for the synthetic one, which shows the means and min-max error bars. All costs are scaled with respect to the cost achieved by running 2-means over the full data set.

**Figure 4.**An example of a QAOA circuit used to solve the weighted Max-Cut problem on an $m=5$ coreset implemented using the swap networks proposed in [33,34]. Here, $p=1$, $\alpha $, and $\beta $ are the variational parameters and the ${w}_{ij}$’s are the edge weights of the constructed graph (see Figure 1). Using the swap network, each qubit is able to interact with every other qubit, $O\left({n}^{2}\right)$ interactions, in linear depth.

**Figure 5.**An experimental evaluation of a QAOA circuit implemented with and without the swap network [33,34]. Each distribution consists of 8192 individual shots. The noisy execution of the quantum hardware becomes apparent when comparing the experimental results with the noiseless simulation. However, by utilizing the swap network, one of the optimal bitstrings (01100) can still be identified in the output distribution with high probability.

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Tomesh, T.; Gokhale, P.; Anschuetz, E.R.; Chong, F.T.
Coreset Clustering on Small Quantum Computers. *Electronics* **2021**, *10*, 1690.
https://doi.org/10.3390/electronics10141690

**AMA Style**

Tomesh T, Gokhale P, Anschuetz ER, Chong FT.
Coreset Clustering on Small Quantum Computers. *Electronics*. 2021; 10(14):1690.
https://doi.org/10.3390/electronics10141690

**Chicago/Turabian Style**

Tomesh, Teague, Pranav Gokhale, Eric R. Anschuetz, and Frederic T. Chong.
2021. "Coreset Clustering on Small Quantum Computers" *Electronics* 10, no. 14: 1690.
https://doi.org/10.3390/electronics10141690