Quantum Algorithms for Classification
Total Page:16
File Type:pdf, Size:1020Kb
Quantum algorithms for classification Alessandro Luongo Twitter: @scinawa https://luongo.pro/qml 26-30-2018, Paris, International Conference on Quantum Computing 1 Prologue 2 Toolbox 3 Quantum algorithms for classification.. Quantum Slow Feature Analysis Quantum Frobenius Distance Classifier q-means 4 ..on real data • Classification • Classification Unsupervised methods Supervised methods × × × X 2 Rn d X 2 Rn d; Y 2 Rn m • Anomaly detection • Regression • Clustering • Pattern recognition • Blind signal separation • Time series forecasting • Text mining • Speech recognition Unsupervised methods Supervised methods × × × X 2 Rn d X 2 Rn d; Y 2 Rn m • Anomaly detection • Regression • Clustering • Pattern recognition • Blind signal separation • Time series forecasting • Text mining • Speech recognition • Classification • Classification Unsupervised Unsupervised Unsupervised Supervised We need Quantum Machine Learning! runtime = O(polylog(size)) [HHL09] ... ML’s algos: runtime = O(poly(size)) = O(poly(n; d))... ... but size = O(2time)... ) problem! ML’s algos: runtime = O(poly(size)) = O(poly(n; d))... ... but size = O(2time)... ) problem! We need Quantum Machine Learning! runtime = O(polylog(size)) [HHL09] ... QML team @ IRIF • Iordanis Kerenidis • Jonas Landman • Anupam Prakash Takeaways • There is an efficient quantum procedure for supervised dimensionality reduction: Quantum Slow Feature Analysis • There is an efficient quantum procedure for supervised classification and distance calculation: Quantum Frobenius Distance Estimator . • There is a new efficient quantum procedure for unsupervised classification: q-means • We simulate quantum algorithm on real data: they work! • QRAM based. Xn q 1 k k j i j i P xi i xi n k k2 i=0 xi i=0 • Execution time: O(log nd) • Preparation time: O(nd log nd) • Size: O(nd log nd) 1 - QRAM Let X 2 Rn×d. There is a quantum algorithm that −1 jii j0i ! jii jxii jxii = kxik jxii • Execution time: O(log nd) • Preparation time: O(nd log nd) • Size: O(nd log nd) 1 - QRAM Let X 2 Rn×d. There is a quantum algorithm that −1 jii j0i ! jii jxii jxii = kxik jxii Xn q 1 k k j i j i P xi i xi n k k2 i=0 xi i=0 1 - QRAM Let X 2 Rn×d. There is a quantum algorithm that −1 jii j0i ! jii jxii jxii = kxik jxii Xn q 1 k k j i j i P xi i xi n k k2 i=0 xi i=0 • Execution time: O(log nd) • Preparation time: O(nd log nd) • Size: O(nd log nd) QRAM [[2,3,4],[5,6,7],[8,9,10]] QRAM + swaps... better Thanks Alex Singh for the circuit (ii) jzi such that kjzi − jMxik ≤ ϵ e in time O(κ(M)µ(M) log(1/ϵ)) j + i (iii) a state M≤θM≤θx ~ µ(M)kxk in time O( k + k) δθ M≤θM≤θx Get estimates of kzk = f(M)x (with mult. error ϵ2, time · −1 O() ϵ2 ) Gilyén, András, et al. ”Quantum singular value transformation and beyond: exponential improvements for quantum matrix arithmetics.” arXiv preprint arXiv:1806.01838 (2018). 2 - Q-BLAS 2 Rd×d k k - M , s.t. M 2 = 1, in QRAM - x 2 Rd in QRAM. There is a quantum algorithm that w.h.p. returns : −1 (i) jzi such that jzi − jM xi ≤ ϵ e in time O(κ(M)µ(M) log(1/ϵ)) j + i (iii) a state M≤θM≤θx ~ µ(M)kxk in time O( k + k) δθ M≤θM≤θx Get estimates of kzk = f(M)x (with mult. error ϵ2, time · −1 O() ϵ2 ) Gilyén, András, et al. ”Quantum singular value transformation and beyond: exponential improvements for quantum matrix arithmetics.” arXiv preprint arXiv:1806.01838 (2018). 2 - Q-BLAS 2 Rd×d k k - M , s.t. M 2 = 1, in QRAM - x 2 Rd in QRAM. There is a quantum algorithm that w.h.p. returns : −1 (i) jzi such that jzi − jM xi ≤ ϵ e in time O(κ(M)µ(M) log(1/ϵ)) (ii) jzi such that kjzi − jMxik ≤ ϵ e in time O(κ(M)µ(M) log(1/ϵ)) Get estimates of kzk = f(M)x (with mult. error ϵ2, time · −1 O() ϵ2 ) Gilyén, András, et al. ”Quantum singular value transformation and beyond: exponential improvements for quantum matrix arithmetics.” arXiv preprint arXiv:1806.01838 (2018). 2 - Q-BLAS 2 Rd×d k k - M , s.t. M 2 = 1, in QRAM - x 2 Rd in QRAM. There is a quantum algorithm that w.h.p. returns : −1 (i) jzi such that jzi − jM xi ≤ ϵ e in time O(κ(M)µ(M) log(1/ϵ)) (ii) jzi such that kjzi − jMxik ≤ ϵ e in time O(κ(M)µ(M) log(1/ϵ)) j + i (iii) a state M≤θM≤θx ~ µ(M)kxk in time O( k + k) δθ M≤θM≤θx 2 - Q-BLAS 2 Rd×d k k - M , s.t. M 2 = 1, in QRAM - x 2 Rd in QRAM. There is a quantum algorithm that w.h.p. returns : −1 (i) jzi such that jzi − jM xi ≤ ϵ e in time O(κ(M)µ(M) log(1/ϵ)) (ii) jzi such that kjzi − jMxik ≤ ϵ e in time O(κ(M)µ(M) log(1/ϵ)) j + i (iii) a state M≤θM≤θx ~ µ(M)kxk in time O( k + k) δθ M≤θM≤θx Get estimates of kzk = f(M)x (with mult. error ϵ2, time · −1 O() ϵ2 ) Gilyén, András, et al. ”Quantum singular value transformation and beyond: exponential improvements for quantum matrix arithmetics.” arXiv preprint arXiv:1806.01838 (2018). 2.5 - Q-BLAS - A; B 2 Rd×d in QRAM k k k k A 2 = B 2 = 1, in QRAM - x 2 Rd in QRAM. There is a quantum algorithm that w.h.p. returns : −1 (i) jzi such that jzi − j(AB) xi ≤ ϵ (ii) jzi such that kjzi − j(AB)xik ≤ ϵ j + i (iii) a state (AB)≤θ,δ(AB)≤θ,δx Get estimates of kzk = f(AB)x (with mult. error ϵ2, time · −1 O() ϵ2 ) Gilyén, András, et al. ”Quantum singular value transformation and beyond: exponential improvements for quantum matrix arithmetics.” arXiv preprint arXiv:1806.01838 (2018). • Before: Quantum Singular Value Estimation X X αi jvii 7! αi jvii jσii i i • Now: Qubitization: W = eiϕ0σz eiθσx eiϕ1σz eiθσx ··· eiϕkσz eiθσx Family of possible W is large enough... 3 - Compute distances × × V 2 Rn d; C 2 Rk d in the QRAM, and ϵ > 0 ( ) e η There is a quantum algorithm that w.h.p. and in time O ϵ jii jji j0i 7! jii jji jd(vi; cj)i maxkvik where jd(vi; cj) − d(vi; cj)j 6 ϵ , where η = . minkvik Based on: Wiebe, N., Kapoor, A., & Svore, K. (2014). Quantum algorithms for nearest-neighbor methods for supervised and unsupervised learning. arXiv preprint arXiv:1401.2142. 3 - sketch proof • Use Quantum Frobenius Dinstance to build: k k pvi pcj jii jji j0i jvii + jii jji j1i jcji Zij Zij • Hadamard on 3rd qubit. 2 1 2 2 d(vi; cj) p(1)ij = (kvik + cj −2 kvik cj hvi; cji) = 2Zij 2Zij • Perform amplitude estimation on L copies. • Use Median Lemma (Wiebe et. al.) • Invert circuit (garbage collection), multiply by 2Zij. 4 - Tomography For a pure quantum state jxi, there is a tomography algorithm with sample and time complexity O(d log d/ϵ2) that produces an estimate e 2 Rd kek ke − k ≤ x with x 2 = 1 such that x x 2 ϵ with probability at least (1 − 1=d0:83). Kerenidis, Iordanis, and Anupam Prakash. ”A quantum interior point method for LPs and SDPs.” arXiv preprint arXiv:1808.09266 (2018). PCA SFA || FLD AW = BWΛ Slow Feature Analysis (Supervised) Input signal: x(i) 2 Rd. Task: Learn K functions: y(i) = [g1(x(i)); ··· ; gK(x(i))] Such that 8j 2 [K]. Minimize: XK X ( ) 1 2 ∆(yj) = gj(x(s)) − gj(x(t)) a 2 k=1 s;t Tk s<t Constraints on output signal: average of components is 0, variance of components is 1, signals are decorrelated. Def Cov. matrix B := XTX, Derivative cov. matrix A := X_ TX_ Slow Feature Analysis (Supervised) Input signal: x(i) 2 Rd. Task: Learn K functions: y(i) = [g1(x(i)); ··· ; gK(x(i))] Such that 8j 2 [K]. Minimize: XK X ( ) 1 2 ∆(yj) = gj(x(s)) − gj(x(t)) a 2 k=1 s;t Tk s<t Constraints on output signal: average of components is 0, variance of components is 1, signals are decorrelated. Def Cov. matrix B := XTX, Derivative cov. matrix A := X_ TX_ AW = BWΛ Step 1: Whitening Data is whitened (sphered) if B = XTX = I. Whitening its just matrix (Moore-Penrose) inversion Z := X+X .. now ZTZ = I Freebie Theorem! There exists an efficient quantum algorithm for whitening that builds jZi Step 2: Projection • Whiten data jXi 7! jZi • Project data in slow feature space jZi 7! jYi New algo! QSFA P T 2 Rn×d _ 2 Rn log n×d - Let X = i σiuivi , X QRAM. - Let ϵ, θ; δ; η > 0. There exists a quantum algorithm that produces: • j i j j i − j + i j ≤ Y with Y A≤θ,δA≤θ,δZ ϵ in time (( ) ) (µ(X) + µ(X_)) jjZjj ~ κ( )µ( ) log( =") + × O X X 1 jj + jj δθ A≤θ,δA≤θ,δZ • kYk s.t. jkYk − kYk j ≤ η kYk with an additional 1/η factor. New algo! QFDC (Supervised) jTk|×d Xk 2 R matrix of elements labeled k jTk|×d X0 2 R repeats the row x0 for jTkj times.