QUANTUM EXPECTATION MAXIMIZATION FOR GAUSSIAN MIX-
Year: 2019

Abstract:
The Expectation-Maximization (EM) algorithm is a fundamental tool in unsupervised machine learning. It is often used as an efficient way to solve Maximum Likelihood (ML) and Maximum A Posteriori estimation problems, especially for models with latent variables. It is also the algorithm of choice to fit mixture models: generative models that represent unlabelled points originating from k different processes, as samples from k multivariate distributions. In this work we define and use a quantum version of EM to fit a Gaussian Mixture Model. Given quantum access to a dataset of n vectors of dimension d, our algorithm has convergence and precision guarantees similar to the classical algorithm, but the runtime is only polylogarithmic in the number of elements in the training set, and is polynomial in other parameters as the dimension of the feature space, and the number of components in the mixture. We generalize further the algorithm by fitting any mixture model of base distributions in the exponential family. We discuss the performance of the algorithm on datasets that are expected to be classified successfully by those algorithms, arguing that on those cases we can give strong guarantees on the runtime.

heading: 1 INTRODUCTION
text: Over the last few years, the effort to find real world applications of quantum computers has greatly intensified. Along with chemistry, material sciences, finance, one of the fields where quantum computers are expected to be most beneficial is machine learning. A number of different algorithms have been proposed for quantum machine learning (Biamonte et al., 2017; Wiebe et al., 2017; Kerenidis & Prakash, 2018; Harrow et al., 2009; Subaşı et al., 2019; Farhi & Neven, 2018), both for the supervised and unsupervised setting, and despite the lack of large-scale quantum computers and quantum memory devises, some quantum algorithms have been demonstrated in proof-of-principle experiments (Li et al., 2015; Otterbach et al., 2017; Jiang et al., 2019). Here, we look at Expectation-Maximization (EM), a fundamental algorithm in unsupervised learning, that can be used to fit different mixture models and give maximum likelihood estimates with the so-called latent variable models. Such generative models are one of the most promising approaches for unsupervised problems. The goal of a generative model is to learn a probability distribution that is most likely to have generated the data collected in a training set V ∈ Rn×d of n vectors of d features. Fitting the model consists in learning the parameters of a probability distribution p in a certain parameterized family that best describes our vectors vi. We will see that, thanks to this formulation, we can reduce a statistical problem into an optimization problem using maximum likelihood estimation (ML) estimation. The likelihood is the function that we use to measure how good a model is for explaining a given dataset. For a given machine learning model with parameters γ, the likelihood of our data set V is the probability that the data have been generated by the model with parameters γ, assuming each point is independent and identically distributed. We think the likelihood as a function of γ, holding the dataset V fixed. For p(vi|γ) the probability that a point vi comes from model γ, the likelihood is defined as L(γ;V ) := ∏n i=1 p(vi|γ). From this formula, we can see that in order to find the best parameters γ∗ of our model we need to solve an optimization problem. For numerical and analytical reasons, instead of maximizing the likelihood L, it is common practice to find the best model by maximizing the log-likelihood function `(γ;V ) = logL(γ;V ) = ∑n i=1 log p(vi|γ). In this context, we want to find the model that maximizes the
log-likelihood: γ∗ML := arg maxγ ∑n i=1 log p(vi|γ). The procedure to calculate the log-likelihood depends on the specific model under consideration. A possible solution would be to use a gradient based optimization algorithm on `. Unfortunately, due to the indented landscape of the function, gradient based techniques often do not perform well. Therefore, it is common to solve the maximum likelihood estimation (or maximum a priori) problem using the Expectation-Maximization (EM) algorithm. EM is an iterative algorithm which is guaranteed to converge to a (local)
optimum of the likelihood. This algorithm has a striking variety of applications, and has been successfully used for medical imaging (Balafar et al., 2010), image restoration (Lagendijk et al., 1990), problems in computational biology (Fan et al., 2010), and so on. EM has been proposed in different works by different authors, but has been formalized as we know it only in 1977 (Dempster et al., 1977). For more details, we refer to (Lindsay, 1995; Bilmes et al., 1998).
In this work, we introduce Quantum Expectation-Maximization (QEM), a new algorithm for fitting mixture models. We detail its usage in the context of Gaussian Mixture Models, and we extend the result to other distributions in the exponential family. We also generalize the result by showing how to compute the MAP: the Maximum A Posteriori estimate of a mixture model. MAP estimates can be seen as the Bayesian version of maximum likelihood estimation problems. MAP estimates are often preferred over ML estimates, due to a reduced propensity to overfit. Our main result can be stated as:
Result (Quantum Expectation-Maximization). (see Theorem 3.9) For a data matrix V ∈ Rn×d stored in an appropriate QRAM data structure and for parameters δθ, δµ > 0 , Quantum Expectation-Maximization (QEM) fits a Maximum Likelihood (or a Maximum A Posteriori) estimate of a Gaussian Mixture Model with k components, in running time per iteration which is dominated by:
Õ
( d2k4.5η3κ2(V )κ2(Σ)µ(Σ)
δ3µ
) , (1)
where Σ is a covariance matrix of a Gaussian distribution, η is a parameter of the dataset related to the maximum norm of the vectors, δθ, δµ are error parameters in the QEM algorithm, µ(< √ d) is a factor appearing in quantum linear algebra and κ is the condition number of a matrix. Here we only kept the term in the running time that dominates for the range of parameters of interest. In Theorem 3.9 we explicate the running time of each step of the algorithm. The QEM algorithm runs for a number of iterations until a stopping condition is met (defined by a parameter τ > 0) which implies a convergence to a (local) optimum.
Let’s have a first high-level comparison of this result with the standard classical algorithms. The runtime of a single iteration in the standard implementation of the EM algorithm is at least O(knd2) (Pedregosa et al., 2011; Murphy, 2012). The advantage of the quantum algorithm is an exponential improvement with respect to the number of elements in the training set, albeit with a worsening on other parameters. It is crucial to find datasets where such a quantum algorithm can offer a speedup. For a reasonable range of parameters ( d = 40, k = 10, η = 10, δ = 0.5, κ(V ) = 25, κ(Σ) = 5, µ(Σ) = 4) which is motivated by some experimental evidence reported in Section 4, datasets where the number of samples in the order of O(1012) might be processed faster on a quantum computer. One should expect that some of the parameters of the quantum algorithm can be improved, especially the dependence on the condition numbers and the errors, which can make enlarge the type of datasets where QEM can offer an advantage. Note that we expect the number of iterations of the quantum algorithm to be proportional to the number of iteration of the classical case. This is to be expected since the convergence rate does not change, and it is corroborated by previous experimental evidence in a similar scenario: the number of iterations needed by q-means algorithm for convergence, is proportional to the number of iterations of the classical k-means algorithm (Kerenidis et al., 2018).
Expectation-Maximization is widely used for fitting mixture models in machine learning (Murphy, 2012). Most mixture models use a base distribution in the exponential family: Poisson (Church & Gale, 1995), Binomial, Multinomial, log-normal (Dexter & Tanner, 1972), exponential (Ghitany et al., 1994), Dirichlet multinomial (Yin & Wang, 2014), and others. EM is also used to fit mixtures of experts, mixtures of the student T distribution (which does not belong to the exponential family, and can be fitted with EM using (Liu & Rubin, 1995)) and for factor analysis, probit regression, and learning Hidden Markov Models (Murphy, 2012).

heading: 1.1 PREVIOUS WORK
text: There is a fair amount of quantum algorithms that have been proposed in the context of unsupervised learning. (Aı̈meur et al., 2013; Lloyd et al., 2013b; Otterbach et al., 2017). Recently, classical machine learning algorithms were obtained by “dequantizing” quantum machine learning algorithms (Tang, 2018b;a;c; Gilyén et al., 2018a; Chia et al., 2018). The runtime of these classical algorithm is poly-logarithmic in the dimensions of the dataset. However, the polynomial dependence on the rank, the error, and the condition number, make these new algorithms impractical on interesting datasets, as shown experimentally by (Arrazola et al., 2019). Fast classical algorithm for GMM exists, albeit assuming only one shared covariance matrix (Dasgupta, 1999), and without a polylogarithmic dependence in the number of
elements in the training set. Independently of us, Miyahara, Aihara, and Lechner extended the q-means algorithm (Kerenidis et al., 2018) for Gaussian Mixture Models (Miyahara et al., 2019), using similar techniques. The main difference is that in their work the update step is performed using a hard-clustering approach (as in the k-means algorithm), that is for updating the centroid and the covariance matrices of a cluster j, only the data points for which cluster j is nearest are taken into account. In our work, we use the soft clustering approach (as in the classical EM algorithm), that is for updating the centroid and the covariance matrices of cluster j, all the data points weighted by their responsibility for cluster j are taken into account. Both approaches have merits and can offer advantages (Kearns et al., 1998).

heading: 2 EXPECTATION-MAXIMIZATION AND GAUSSIAN MIXTURE MODELS
text: As is common in machine learning literature, we introduce the Expectation-Maximization algorithm by using it to fit Gaussian Mixture Models (GMM). Mixture models are a popular generative model in machine learning. The intuition behind mixture models is to model complicated distributions by using a group of simpler (usually uni-modal) distributions. In this setting, the purpose of the learner is to model the data by fitting the joint probability distribution which most likely have generated our samples. In this section we describe GMM: probably the most used mixture model used to solve unsupervised classification problems. In fact, given a sufficiently large number of mixture components, it is possible to approximate any density defined in Rd (Murphy, 2012). In unsupervised settings, we are given a training set of unlabeled vectors v1 · · · vn ∈ Rd which we represent as rows of a matrix V ∈ Rn×d. Let yi ∈ [k] one of the k possible labels for a point vi. We posit that the joint probability distribution of the data p(vi, yi) = p(vi|yi)p(yi), is defined as follow: yi ∼ Multinomial(θ) for θ ∈ Rk, and p(vi|yi = j) ∼ N (µj ,Σj). The θj are the mixing weights, i.e. the probabilities that yi = j, and N (µj ,Σj) is the Gaussian distribution centered in µj ∈ Rd with covariance matrix Σj ∈ Rd×d. Note that the variables yi are unobserved, and thus are called latent variables. There is a simple interpretation for this model. We assume the data is created by first selecting an index j ∈ [k] by sampling according to Multinomial(θ), and then a vector vi is sampled from N (µj ,Σj). Fitting a GMM to a dataset reduces to finding an assignment for the parameters: γ = (θ,µ,Σ) = (θ, µ1, · · · , µk,Σ1, · · · ,Σk) that best maximize the log-likelihood for a given dataset. Note that the algorithm used to fit GMM can return a local minimum which might be different than γ∗: the model that represents the global optimum of the likelihood function. We use the letter φ to represent our base distribution, which in this case is the probability density function of a multivariate Gaussian distribution N (µ,Σ). Using this formulation, a GMM is expressed as: p(v) = ∑k j=1 θjφ(v;µj ,Σj) where θj are the mixing weights of the
multinomial distribution such that ∑k j=1 θj = 1. The probability for an observation vi to be assigned to the component j is given by: rij = θjφ(vi;µj ,Σj)∑k l=1 θlφ(vi;µl,Σl)
. This value is called responsibility, and corresponds to the posterior probability of the sample i being assigned label j by the current model. As anticipated, to find the best parameters of our generative model, we maximize the log-likelihood of the data. For GMM, the likelihood is given by the following formula (Ng, 2012):`(γ;V ) = `(θ,µ,Σ;V ) = ∑n i=1 log p(vi ; θ,µ,Σ) =. Alas, it is seldom possible to solve maximum likelihood estimation analytically (i.e. by finding the zeroes of the derivatives of the log-like function, and this is one of those cases. Fortunately, Expectation-Maximization is an iterative algorithm that solves numerically the optimization problem of ML estimation. To complicate things, the likelihood function for GMM is not convex, and thus we might find some local minima (Hastie et al., 2009). If we were to know the latent variable yi, then the log-likelihood for GMM would be:f `(γ;V ) = ∑n i=1 log p(vi | yi;µ,Σ) + log p(yi; θ) This formula can be easily maximized with respect to the parameters θ,µ, and Σ. In the Expectation step we calculate the missing variables yi’s, given a guess of the parameters (θ,µ,Σ) of the model. Then, in the Maximization step, we use the estimate of the latent variables obtained in the Expectation step to update the estimate of the parameters. While in the Expectation step we calculate a lower bound on the likelihood, in the Maximization step we maximize it. Since at each iteration the likelihood can only increase, the algorithm is guaranteed to converge, albeit possibly to a local optimum (see (Hastie et al., 2009) for the proof). During the Expectation step all the responsibilities are calculated, while in the Maximization step we update our estimate on the parameters γt+1 = (θt+1,µt+1,Σt+1). The stopping criterion for GMM is usually a threshold on the increment of the log-likelihood: if the log-likelihood changes less than a threshold between two iterations, then the algorithm stops. Notice that, since the value of the log-likelihood significantly depends on the amount of data points in the training sets, it is often preferable to adopt a scale-free stopping criterion, which does not depend on the number of samples. For instance, in the toolkit scikit-learn (Pedregosa et al., 2011) the stopping criterion is given by a tolerance on the average increment of the log-probability, which is chosen to be smaller than a certain τ , say 10−3. More precisely, the stopping criterion is |E[log p(vi; γt)] − E[log p(vi; γt+1)]| < τ which we can estimate as | 1n ∑n i=1 log p(vi; γ t)− 1n ∑n i=1 log p(vi; γ t+1)| < τ .
Dataset assumptions in GMM As in q-means (Kerenidis et al., 2018), we have an assumption on the dataset that all elements of the mixture contribute proportionally to the total responsibility: i, e∑n
i=1 rij∑n i=1 ril = Θ(1) ∀j, l ∈ [k]
This is equivalent to requiring that clusters share a comparable amount of points in the “well-clusterability” assumption in q-means (Kerenidis et al., 2018). It is also equivalent to assuming that θj/θl = Θ(1) ∀j, l ∈ [k]. For convenience, in this work, we also assume that the dataset is normalized such that the shortest vector has norm 1 and define η := maxi ‖vi‖2 to be the maximum norm squared of a vector in the dataset. This is not a necessary requirement for our dataset, but it will simplify the analysis of our algorithm, allowing us to give strict bounds on the runtime.
Preliminaries We assume a basic understanding of quantum computing, we recommend Nielsen and Chuang (Nielsen & Chuang, 2002) for an introduction to the subject. A vector state |v〉 for v ∈ Rd is defined as |v〉 = 1‖v‖ ∑ j∈[d] vj |j〉, where |j〉 represents ej , the jth vector in the standard basis. The dataset is represented by a matrix V ∈ Rn×d, i.e. each row is a vector vi ∈ Rd for i ∈ [n] that represents a single data point. The cluster centers, called centroids, at time t are stored in the matrix Ct ∈ Rk×d, such that the jth row ctj for j ∈ [k] represents the centroid of the cluster Ctj . We denote as V≥τ the matrix ∑` i=0 σiuiv T i where σ` is the smallest singular value which is greater than τ . With nnz(V ) we mean the number of non-zero elements of the rows of V . When we say κ(V ) we mean the condition number of the matrix V , that is the ratio between the biggest and the smallest (non-zero) singular value. All the tools used in this work, like quantum algorithms for computing distances and linear algebraic operations, are reported in the Supplementary Material section.

heading: 3 QUANTUM EXPECTATION-MAXIMIZATION FOR GMM
text: In this section, we present a quantum Expectation-Maximization algorithm to fit a GMM. The algorithm can also be adapted fit other mixtures models where the probability distributions belong to the exponential family. As the GMM is both intuitive and one of the most widely used mixture models, our results are presented for the GMM case.
A robust version of the EM algorithm Similar to the work of (Kerenidis et al., 2018), we define a ∆-robust version of the EM algorithm which we use to fit a GMM. The difference between this formalization and the original EM for GMM is simple. Here we explain the numerical error introduced in the training algorithm.
Let γt = (θt,µt,Σt) = (θt, µt1 · · ·µtk,Σt1 · · ·Σtk) a model fitted by the standard EM algorithm from γ0 an initial guess of the parameters, i.e. γt is the error-free model that standard EM would have returned after t iterations. Starting from the same choice of initial parameters γ0, fitting a GMM with the QEM algorithm with ∆ = (δθ, δµ) means returning a model γt = (θ t ,µt,Σ t ) such that:
∥∥∥θt − θt∥∥∥ < δθ, that ∥∥µjt − µtj∥∥ < δµ for all j ∈ [k], and that∥∥∥Σjt − Σtj∥∥∥ ≤ δµ√η. Quantum access to the mixture model As in the classical algorithm, we use some subroutines to compute the responsibilities and update our current guess of the parameters. The classical algorithm has clearly two separate steps for Expectation and Maximization. In contrast, the quantum algorithm uses a subroutine to compute the responsibilities inside the step that performs the Maximization, that is the subroutines for computing responsibilities are called multiple times during the quantum Maximization step. During the quantum Maximization step, the algorithm updates the model parameters γt by creating quantum states corresponding to parameters γt+1 and then recovering classical estimates for these parameters using quantum tomography or amplitude amplification. In order for this subroutines to be efficient, the values of the GMM are stored in QRAM data structures and are updated following each maximization step. Definition 1 (Quantum access to a GMM). We say that we have quantum access to a GMM if the dataset V ∈ Rn×d and model parameters θj ∈ R, µj ∈ Rd,Σj ∈ Rd×d for all j ∈ [k] are stored in QRAM data structures which allow us to perform in time O(polylog(d)) the following mappings:
• |j〉 |0〉 7→ |j〉 |µj〉 for all j ∈ [k],
• |j〉 |i〉 |0〉 7→ |j〉 |i〉 |σji 〉 for j ∈ [k], i ∈ [d] where σ j i is the i-th rows of Σj ∈ Rd×d,
• |i〉 |0〉 7→ |i〉 |vi〉 for all i ∈ [n],
• |i〉 |0〉 |0〉 7→ |i〉 |vec[vivTi ]〉 = |i〉 |vi〉 |vi〉 for all i ∈ [n],
• |j〉 |0〉 7→ |j〉 |θj〉.
Algorithm 1 Quantum Expectation Maximization for GMM Require: Quantum access to a GMM model, precision parameters δθ, δµ, and threshold τ . Ensure: A GMM γt that maximizes locally the likelihood `(γ;V ), up to tolerance τ .
1: Use a heuristic described at the beginning of this section to determine an initial guess for γ0 = (θ0,µ0,Σ0), and store these parameters in the QRAM. 2: Use Lemma 3.1 to estimate the log determinant of the matrices {Σ0j}kj=1. 3: t=0 4: repeat 5: Step 1: Get an estimate of θt+1 such that
∥∥∥θt+1 − θt+1∥∥∥ ≤ δθ using Lemma 3.4. 6: Step 2: Get an estimate {µjt+1}kj=1 by using Lemma 3.6 to estimate each
∥∥µt+1j ∥∥ and |µt+1j 〉 such that∥∥µt+1j − µjt+1∥∥ ≤ δµ. 7: Step 3: Get an estimate {Σj
t+1}kj=1 by using Lemma 3.7 to estimate ∥∥Σt+1j ∥∥F and |Σt+1j 〉 such that∥∥∥Σt+1j − Σjt+1∥∥∥ ≤ δµ√η.
8: Step 4: Estimate E[p(vi; γt+1)] up to error τ/2 using Theorem 3.8. 9: Step 5: Store γt+1 in the QRAM, and use Lemma 3.1 to estimate the determinants {log det(Σt+1j )}kj=0.
10: t = t+ 1 11: until
|E[p(vi; γt)]− E[p(vi; γt−1)]| < τ
12: Return γt = (θ t ,µt,Σ t )
Quantum initialization strategies exists, and are described in the Appendix.

heading: 3.1 EXPECTATION
text: In this step of the quantum algorithm we are just showing how to compute efficiently the responsibilities as a quantum state. First, we compute the responsibilities in a quantum register, and then we show how to put them as amplitudes of a quantum state. We start by a classical algorithm used to efficiently approximate the log-determinant of the covariance matrices of the data. At each iteration of Quantum Expectation-Maximization we need to compute the determinant of the updated covariance matrices, which is done thanks to Lemma 3.1. We will see from the error analysis that in order to get an estimate of the GMM, we need to call Lemma 3.1 with precision for which the runtime of Lemma 3.1 gets subsumed by the running time of finding the updated covariance matrices through 3.7. Thus, we do not explicitly write the time to compute the determinant from now on in the algorithm and when we say that we update Σ we include an update on the estimate of log(det(Σ)) as well.
Lemma 3.1 (Determinant evaluation). There is an algorithm that, given as input a matrix Σ and a parameter 0 < δ < 1, outputs an estimate log(det(Σ)) such that |log(det(Σ))− log(det(Σ))| ≤ with probability 1− δ in time:
TDet, = Õ ( −2κ(Σ) log(1/δ)nnz(Σ)| log(det(Σ))| ) Now we can state the main brick used to compute the responsability: a quantum algorithm for evaluating the exponent of a Gaussian distribution.
Lemma 3.2 (Quantum Gaussian Evaluation). Suppose we have stored in the QRAM a matrix V ∈ Rn×d, the centroid µ ∈ Rd and the covariance matrix Σ ∈ Rd×d of a multivariate Gaussian distribution φ(v|µ,Σ), as well as an estimate for log(det(Σ)). Then for 1 > 0, there exists a quantum algorithm that with probability 1− γ performs the mapping,
• UG, 1 : |i〉 |0〉 → |i〉 |si〉 such that |si − si| < 1, where si = − 12 ((vi − µ) TΣ−1(vi − µ) + d log 2π +
log(det(Σ))) is the exponent for the Gaussian probability density function.
The running time of the algorithm is TG, 1 = O ( κ2(Σ)µ(Σ) log(1/γ) 1 η ) .
Using controlled operations it is simple to extend the previous Theorem to work with multiple Gaussians distributions (µj ,Σj). That is, we can control on a register |j〉 to do |j〉 |i〉 |0〉 7→ |j〉 |i〉 |φ(vi|µj ,Σj)〉. In the next Lemma we will see how to obtain the responsibilities rij using the previous Theorem and standard quantum circuits for doing arithmetic, controlled rotations, and amplitude amplification. The Lemma is stated in a general way, to be used with any probability distributions that belong to an exponential family.
Lemma 3.3 (Calculating responsibilities). Suppose we have quantum access to a GMM with parameters γt = (θt,µt,Σt). There are quantum algorithms that can:
1. Perform the mapping |i〉 |j〉 |0〉 7→ |i〉 |j〉 |rij〉 such that |rij − rij | ≤ 1 with probability 1− γ in time:
TR1, 1 = Õ(k 1.5 × TG, 1)
2. For a given j ∈ [k], construct state |Rj〉 such that ∥∥∥∥|Rj〉 − 1√Zj n∑i=0 rij |i〉 ∥∥∥∥ < 1 where Zj = n∑ i=0 r2ij with
high probability in time: TR2, 1 = Õ(k 2 × TR1, 1)

heading: 3.2 MAXIMIZATION
text: Now we need to get a new estimate for the parameters of our model. This is the idea: at each iteration we recover the new parameters of the model as quantum states, and then recover it using tomography, amplitude estimation, or sampling. Once the new model has been recovered, we update the QRAM such that we get quantum access to the model γt+1. The possibility to estimate θ comes from a call to the unitary we built to compute the responsibilities, and postselection.
Lemma 3.4 (Computing θt+1). We assume quantum access to a GMM with parameters γt and let δθ > 0 be a precision parameter. There exists an algorithm that estimates θ t+1 ∈ Rk such that ∥∥∥θt+1 − θt+1∥∥∥ ≤ δθ in time
Tθ = O ( k3.5η1.5 κ
2(Σ)µ(Σ) δ2θ ) We use quantum linear algebra to transform the uniform superposition of responsibilities of the j-th mixture into the new centroid of the j-th Gaussian. Let Rtj ∈ Rn be the vector of responsibilities for a Gaussian j at iteration t. The following claim relates the vectors Rtj to the centroids µ t+1 j .
Claim 3.5. Let Rtj ∈ Rn be the vector of responsibilities of the points for the Gaussian j at time t, i.e. (Rtj)i = rtij . Then µt+1j ← ∑n i=1 r t ijvi∑n
i=1 r t ij = V TRtj nθj .
The proof is straightforward.
Lemma 3.6 (Computing µt+1j ). We assume we have quantum access to a GMM with parameters γt. For a precision parameter δµ > 0, there is a quantum algorithm that calculates {µjt+1}kj=1 such that for all j ∈ [k]∥∥µjt+1 − µt+1j ∥∥ ≤ δµ in time Tµ = Õ (kdηκ(V )(µ(V )+k3.5η1.5κ2(Σ)µ(Σ))δ3µ ) From the ability to calculate responsibility and indexing the centroids, we derive the ability to reconstruct the covariance matrix of the Gaussians as well. Again, we use quantum linear algebra subroutines and tomography to recover an approximation of each Σj . Recall that we have defined the matrix V ′ ∈ Rn×d 2
where the i-th row of V ′ is defined as vec[vivTi ]. For this Lemma, we assume to have the matrix stored in the QRAM. This is a reasonable assumption as the quantum states corresponding to the rows of V ′ can be prepared as |i〉 |0〉 |0〉 → |i〉 |vi〉 |vi〉, using twice the procedure for creating the rows of V .
Lemma 3.7 (Computing Σt+1j ). We assume we have quantum access to a GMM with parameters γt. We also have computed estimates µjt+1 of all centroids such that ∥∥µjt+1 − µt+1j ∥∥ ≤ δµ for precision parameter δµ > 0. Then, there exists a quantum algorithm that outputs estimates for the new covariance matrices {Σt+1j }kj=1 such that∥∥∥Σt+1j − Σt+1j ∥∥∥
F ≤ δµ
√ η with high probability, in time,
TΣ := Õ (kd2ηκ2(V )(µ(V ′) + η2k3.5κ2(Σ)µ(Σ))
δ3µ )

heading: 3.3 QUANTUM ESTIMATION OF LOG-LIKELIHOOD
text: Now we are going to show how it is possible to get an estimate of the log-likelihood using a quantum procedure and access to a GMM model. A good estimate is crucial, as it is used as stopping criteria for the quantum algorithm as well. Classically, we stop to iterate the EM algorithm when |`(γt;V ) − `(γt+1;V )| < n , or equivalently, we can set a tolerance on the average increase in log probability: |E[log p(vi; γt)] − E[log p(vi; γt+1)]| < . In the quantum algorithm it is more practical to estimate E[p(vi; γt)] = 1n ∑n i=1 p(vi; γ). From this we can estimate an upper bound
on the log-likelihood as n logE[p(vi)] = ∑n i=1 logE[p(vi)] ≥ ∑n i=1 log p(vi) = `(γ;V ). Lemma 3.8 (Quantum estimation of likelihood). We assume we have quantum access to a GMM with parameters γt. For τ > 0, there exists a quantum algorithm that estimates E[p(vi; γt)] with absolute error τ in time
T` = Õ
( k1.5η1.5 κ2(Σ)µ(Σ)
2τ ) Putting together all the previous Lemmas, we write the main result of the work. Theorem 3.9 (QEM for GMM). We assume we have quantum access to a GMM with parameters γt. For parameters δθ, δµ, τ > 0, the running time of one iteration of the Quantum Expectation-Maximization (QEM) algorithm is
O(Tθ + Tµ + TΣ + T`), for Tθ = Õ ( k3.5η1.5 κ
2(Σ)µ(Σ) δ2θ
) , Tµ = Õ ( kdηκ(V )(µ(V )+k3.5η1.5κ2(Σ)µ(Σ))
δ3µ
) , TΣ =
Õ ( kd2ηκ2(V )(µ(V ′)+η2k3.5κ2(Σ)µ(Σ))
δ3µ
) and T` = Õ ( k1.5η1.5 κ
2(Σ)µ(Σ) 2τ ) For the range of parameters of interest, the running time is dominated by TΣ.
The proof follows directly from the previous lemmas. Note that the cost of the whole algorithm is given by repeating the Estimation and the Maximization steps several times, until the threshold on the log-likelihood is reached. Note also that the expression of the runtime can be simplified from the observation that the cost of performing tomography on the covariance matrices Σj dominates the cost.

heading: 4 EXPERIMENTAL RESULTS
text: In this section, we present the results of some experiments on real datasets to bound the condition number and the other parameters of the runtime. Let’s discuss the value of κ(Σ), κ(V ), µ(Σ), and µ(V ). We can thresholding the condition number by discarding small singular values of the matrix, as used in quantum linear algebra, might be advantageous. This is indeed done often in classical machine learning models, since discarding the eigenvalues smaller than a certain threshold might even improve upon the metric under consideration (i.e. often the accuracy), and is a form of regularization (Murphy, 2012, Section 6.5). This is equivalent to limiting the eccentricity of the Gaussians. We can have a similar consideration on the condition number of the dataset κ(V ). As shown before, the condition number of the matrix V ′ appearing in Lemma 3.2 is κ2(V ). Similarly, we can claim that the value of µ(V ) will not increase significantly as we add vectors to the training set. Remember that we have some choice in picking the function µ: in previous experiments we have found that choosing the maximum `1 norm of the rows of V lead to values of µ around 10, and also in this case we expect the samples of a well-clusterable (Kerenidis et al., 2018) dataset to be constant. Also, µ is bounded by the Frobenius norm of V . In case the matrix V can be clustered with high-enough accuracy by
k-means, it has been showed that the Frobenius norm of the matrix is proportional to √ k. Given that EM is a more powerful extension of k-means, we can rely on similar observations too. Usually, the number of features d is much more than the number of components in the mixture, i.e. d k, so we expect d2 to dominate the k3.5 term in the cost needed to estimate the mixing weights. This makes the runtime of a single iteration proportional to:
Õ
( d2k4.5η3κ2(V )κ2(Σ)µ(Σ)
δ3µ
) (2)
As we said, the quantum running time saves the factor that depends on the number of samples and introduces a number of other parameters. Using our experimental results we can see that when the number of samples is large enough one can expect the quantum running time to be faster than the classical one. Note as well that one can expect to save some more factors from the quantum running time with a more careful analysis.
Experiments. In the algorithm, we need to set the parameters δµ and δθ to be small enough such that the likelihood is perturbed less than τ/4. We have reasons to believe that on well-clusterable data, the value of these parameters will be large enough, such as not to impact dramatically the runtime. A quantum version of k-means algorithm has already been simulated on real data under similar assumptions (Kerenidis et al., 2018). There, the authors analyzed on the MNIST dataset the performances of q-means, the δ-resistant version of the classical k-means algorithm. The experiment concluded that, for datasets that are expected to be clustered nicely by this kind of clustering algorithms, the value of the parameters δµ, δθ did not decrease by increasing the number of samples nor the number of features. We expect similar behaviour in the EM case, namely that for large datasets the impact on the runtime of the errors (δµ, δθ) does not cancel out the exponential gain in the dependence on the number of samples. For instance, in all the experiments of q-means (Kerenidis et al., 2018) on the MNIST dataset the value of δµ (which in their case was called just δ) has been between 0.2 and 0.5. The value of τ is usually (for instance in scikit-learn (Pedregosa et al., 2011) ) chosen to be 10−3. The value of η has always been below 11.
We also analyzed some other real-world dataset, which can be fitted well with the EM algorithm (Reynolds et al., 2000; APPML; Voxforge.org) to perform speaker recognition: the task of recognizing a speaker from a voice sample, having access to a training set of recorded voices of all the possible speakers. Details of the measurements are reported in the Supplementary Material section, here we report only the results in Table 1. After this, we also experimented the impact of errors on the mixing weights in the accuracy of a ML estimate of a GMM by perturbing the trained model, by adding some random noise. With a value of δθ = 0.035, δµ = 0.5 we correctly classified 98.2% utterances.
In conclusion, the experimental results suggest that the influence of the extra parameters in the quantum running time (condition thresholds, errors, etc.) is moderate. This allows us to be optimistic that, when quantum computers with quantum access to data become a reality, our algorithm (and improved versions that reduce even more the complexity with respect to these extra parameters) could be useful in analyzing large datasets.

heading: 5 ACKNOWLEDGEMENTS
text: We would like to thank the authors of (Miyahara et al., 2019) for sharing an early version of their manuscript with us. Part of this research was supported by the projects: ANR QuDATA and QuantERA QuantAlgo.

heading: 6 SUPPLEMENTARY MATERIAL

heading: 6.1 PREVIOUS RESULTS USED IN THE PROOFS
text: Here we report useful Theorems, Lemmas, and Claims that we use in the main text. Theorem 6.1 (Determinant estimation (Boutsidis et al., 2017)). Let M ∈ Rd×d be a positive definite matrix with eigenvalues in the interval (σmin, 1). Then for all δ ∈ (0, 1) and > 0 there is a classical algorithm that outputs log(det(M)) such that |log(det(M))− log(det(M))| ≤ 2 | log(det(M))| with probability at least 1− δ in time
TDet, := O
( log(1/ ) log(1/δ)
2σmin nnz(M)
) .
Theorem 6.2 (Multivariate Mean Value Theorem (Rudin et al., 1964)). LetU be an open set of Rd. For a differentiable functions f : U 7→ R it holds that ∀x, y ∈ U, ∃c such that f(x)− f(y) = ∇f(c) · (x− y). Theorem 6.3 (Componentwise Softmax function σj(v) is Lipschitz continuous). For d > 2, let σj : Rd 7→ (0, 1) be the softmax function defined as σj(v) = e
vj∑d l=1 e vl Then σj is Lipschitz continuous, with K ≤ √ 2.
Algorithm 2 Expectation-Maximization for GMM Require: Dataset V , tolerance τ > 0. Ensure: A GMM γt = (θt,µt,Σt) that maximizes locally the likelihood `(γ;V ) up to tolerance τ .
1: Select γ0 = (θ0,µ0,Σ0) using classical initialization strategies described in Subsection 6.3. 2: t = 0 3: repeat 4: Expectation
∀i, j, calculate the responsibilities as:
rtij = θtjφ(vi;µ t j ,Σ t j)∑k
l=1 θ t lφ(vi;µ t l ,Σ t l)
(3)
5: Maximization Update the parameters of the model as:
θt+1j ← 1
n n∑ i=1 rtij (4)
µt+1j ← ∑n i=1 r t ijvi∑n
i=1 r t ij
(5)
Σt+1j ← ∑n i=1 r t ij(vi − µ t+1 j )(vi − µ t+1 j )
T∑n i=1 r t ij
(6)
6: t=t+1 7: until 8: |`(γt−1;V )− `(γt;V )| < τ (7) 9: Return γt = (θt,µt,Σt)
Proof. We need to find the K such that for all x, y ∈ Rd, we have that ‖σj(y)− σj(x)‖ ≤ K ‖y − x‖. Observing that σj is differentiable and that if we apply Cauchy-Schwarz to the statement of the Mean-Value-Theorem we derive that ∀x, y ∈ U, ∃c such that ‖f(x)− f(y)‖ ≤ ‖∇f(c)‖F ‖x− y‖. So to show Lipschitz continuity it is enough to select K ≤ ‖∇σj‖∗F = maxc∈Rd ‖∇σj(c)‖.
The partial derivatives dσj(v)dvi are σj(v)(1 − σj(v)) if i = j and −σi(v)σj(v) otherwise. So ‖∇σj‖ 2 F =∑d−1 i=1 (−σ(v)iσj(v))2 + σj(v)2(1 − σj(v))2 ≤ ∑d−1 i=1 σ(v)iσj(v) + σj(v)(1 − σj(v)) ≤ σj(v) ∑d−1 i=0 σi(v) + 1 −
σj(v) ≤ 2σj(v) ≤ 2. In our case we can deduce that: ‖σj(y)− σj(x)‖ ≤ √ 2 ‖y − x‖ so K ≤ √ 2.
Claim 6.4. (Kerenidis & Prakash, 2017b) Let θ be the angle between vectors x, y, and assume that θ < π/2. Then, ‖x− y‖ ≤ implies ‖|x〉 − |y〉‖ ≤ √ 2 ‖x‖ .
We will also use Claim 4.5 from (Kerenidis et al., 2018). Claim 6.5. (Kerenidis et al., 2018) Let b be the error we commit in estimating |c〉 such that ‖|c〉 − |c〉‖ < b, and a the error we commit in the estimating the norms, | ‖c‖ − ‖c‖| ≤ a ‖c‖. Then ‖c− c‖ ≤ √ η( a + b).
Definition 2 (Exponential Family(Murphy, 2012)). A probability density function or probability mass function p(v|ν) for v = (v1, · · · , vm) ∈ Vm, where V ⊆ R, ν ∈ Rp is said to be in the exponential family if can be written as:
p(v|ν) := h(v) exp{o(ν)TT (v)−A(ν)} where:
• ν ∈ Rp is called the canonical or natural parameter of the family,
• o(ν) is a function of ν (which often is just the identity function),
• T (v) is the vector of sufficient statistics: a function that holds all the information the data v holds with respect to the unknown parameters,
• A(ν) is the cumulant generating function, or log-partition function, which acts as a normalization factor,
• h(v) > 0 is the base measure which is a non-informative prior and de-facto is scaling constant.

heading: 6.2 QUANTUM PROCEDURES
text: To prove our results, we are going to use the quantum procedures listed hereafter. Theorem 6.6 (Amplitude estimation and amplification (Brassard et al., 2002)). If there is unitary operator U such that U |0〉l = |φ〉 = sin(θ) |x, 0〉 + cos(θ) |G, 0⊥〉 then sin2(θ) can be estimated to multiplicative error η in time O( T (U)η sin(θ) ) and |x〉 can be generated in expected time O( T (U) sin(θ) ).
We also need some state preparation procedures. These subroutines are needed for encoding vectors in vi ∈ Rd into quantum states |vi〉. An efficient state preparation procedure is provided by the QRAM data structures. We stress the fact that our result continues to hold, no matter how the efficient quantum loading of the data is provided. For instance, the data can be accessed through a QRAM, through a block encoding, or when the data can be produced by quantum circuits. Theorem 6.7 (QRAM data structure (Kerenidis & Prakash, 2017a)). Let V ∈ Rn×d, there is a data structure to store the rows of V such that,
1. The time to insert, update or delete a single entry vij is O(log 2(n)).
2. A quantum algorithm with access to the data structure can perform the following unitaries in time T = O(log2N).
(a) |i〉 |0〉 → |i〉 |vi〉 for i ∈ [n]. (b) |0〉 → ∑ i∈[n] ‖vi‖ |i〉.
In our algorithm we will also use subroutines for quantum linear algebra. For a symmetric matrix M ∈ Rd×d with spectral norm ‖M‖ = 1 stored in the QRAM, the running time of these algorithms depends linearly on the condition number κ(M) of the matrix, that can be replaced by κτ (M), a condition threshold where we keep only the singular values bigger than τ , and the parameter µ(M), a matrix dependent parameter defined as
µ(M) = min p∈P
(‖M‖F , √ s2p(M)s2(1−p)(MT )),
for sp(M) := maxi∈[n] ‖mi‖ p p where ‖mi‖p is the `p norm of the i-th row of M , and P is a finte set of size O(1) ∈ [0, 1]. Note that µ(M) ≤ ‖M‖F ≤ √ d as we have assumed that ‖M‖ = 1. The running time also depends logarithmically on the relative error of the final outcome state. (Chakraborty et al., 2018; Gilyén et al., 2018b). Theorem 6.8 (Quantum linear algebra (Chakraborty et al., 2018; Gilyén et al., 2018b) ). Let M ∈ Rd×d such that ‖M‖2 = 1 and x ∈ Rd. Let , δ > 0. If M is stored in appropriate QRAM data structures and the time to prepare |x〉 is Tx, then there exist quantum algorithms that with probability at least 1− 1/poly(d) return a state |z〉 such that ‖|z〉 − |Mx〉‖ ≤ in time Õ((κ(M)µ(M) + Txκ(M)) log(1/ )). Theorem 6.9 (Quantum linear algebra for matrix products (Chakraborty et al., 2018) ). Let M1,M2 ∈ Rd×d such that ‖M‖1 = ‖M‖2 = 1 and x ∈ Rd, and a vector x ∈ Rd stored in QRAM. Let > 0. Then there exist quantum algorithms that with probability at least 1 − 1/poly(d) returns a state |z〉 such that ‖|z〉 − |Mx〉‖ ≤ in time Õ((κ(M)(µ(M1)TM1 + µ(M2)TM2)) log(1/ )), where TM1 , TM2 is the time needed to index the rows of M1 and M2.
The linear algebra procedures above can also be applied to any rectangular matrix V ∈ RN×d by considering instead the symmetric matrix V = (
0 V V T 0
) .
The final component needed for the q-means algorithm is a linear time algorithm for vector state tomography that will be used to recover classical information from the quantum states corresponding to the new centroids in each step. Given a unitary U that produces a quantum state |x〉, by calling O(d log d/ 2) times U , the tomography algorithm is able to reconstruct a vector x̃ that approximates |x〉 such that ‖|x̃〉 − |x〉‖ ≤ . Theorem 6.10 (Vector state tomography (Kerenidis & Prakash, 2018)). Given access to unitary U such that U |0〉 = |x〉 and its controlled version in time T (U), there is a tomography algorithm with time complexityO(T (U)d log d 2 ) that produces unit vector x̃ ∈ Rd such that ‖x̃− x‖2 ≤ with probability at least (1− 1/poly(d)). Lemma 6.11 (Distance / Inner Products Estimation (Kerenidis et al., 2018; Wiebe et al., 2014; Lloyd et al., 2013a)). Assume for a data matrix V ∈ RN×d and a centroid matrix C ∈ Rk×d that the following unitaries |i〉 |0〉 7→ |i〉 |vi〉 , and |j〉 |0〉 7→ |j〉 |cj〉 can be performed in time T and the norms of the vectors are known. For any ∆ > 0 and > 0, there exists a quantum algorithm that computes
|i〉 |j〉 |0〉 7→ |i〉 |j〉 |d2(vi, cj)〉 , where |d2(vi, cj)− d2(vi, cj)| 6 with probability at least 1− 2∆, or |i〉 |j〉 |0〉 7→ |i〉 |j〉 |(vi, cj)〉 , where |(vi, cj)− (vi, cj)| 6 with probability at least 1− 2∆
in time Õ ( ‖vi‖‖cj‖T log(1/∆) ) .

heading: 6.3 INITIALIZATION STRATEGIES FOR EM
text: Unlike k-means clustering, choosing a good set of initial parameters for a mixture of Gaussian is by no means trivial, and in multivariate context is known that the solution is problem-dependent. There are plenty of proposed techniques, and here we describe a few of them. Fortunately, these initialization strategies can be directly translated into quantum subroutines without impacting the overall running time of the quantum algorithm.
The simplest technique is called random EM, and consists in selecting initial points at random from the dataset as centroids, and sample the dataset to estimate the covariance matrix of the data. Then these estimates are used as the starting configuration of the model, and we may repeat the random sampling until we get satisfactory results.
A more standard technique borrows directly the initialization strategy of k-means++ proposed in (Arthur & Vassilvitskii, 2007), and extends it to make an initial guess for the covariance matrices and the mixing weights. The initial guess for the centroids is selected by sampling from a suitable, easy to calculate distribution. This heuristic works as following: Let c0 be a randomly selected point of the dataset, as first centroid. The other k−1 centroids are selected by selecting a vector vi with probability proportional to d2(vi, µl(vi)), where µl(vi) is the previously selected centroid that is the closest to vi in `2 distance. These centroids are then used as initial centroids for a round of k-means algorithm to obtain µ01 · · ·µ0j . Then, the covariance matrices can be initialized as Σ0j := 1|Cj | ∑ i∈Cj (vi − µj)(vi − µj)
T , where Cj is the set of samples in the training set that have been assigned to the cluster j in the previous round of k-means. The mixing weights are estimated as Cj/n. Eventually Σ0j is regularized to be a PSD matrix. There are other possible choices for parameter initialization in EM, for instance, based on Hierarchical Agglomerative Clustering (HAC) and the CEM algorithm. In CEM we run one step of EM, but with a so-called classification step between E and M. The classification step consists in a hard-clustering after computing the initial conditional probabilities (in the E step). The M step then calculates the initial guess of the parameters (Celeux & Govaert, 1992). In the small EM initialization method we run EM with a different choice of initial parameters using some of the previous strategies. The difference here is that we repeat the EM algorithm for a few numbers of iterations, and we keep iterating from the choice of parameters that returned the best partial results. For an overview and comparison of different initialization techniques, we refer to (Blömer & Bujna, 2013; Biernacki et al., 2003).
Quantum initialization strategies For the initialization of γ0 in the quantum algorithm we can use the same initialization strategies as in classical machine learning. For instance, we can use the classical random EM initialization strategy for QEM.
A quantum initialization strategy can also be given using the k-means++ initializion strategy from (Kerenidis et al., 2018), which returns k initial guesses for the centroids c01 · · · c0k consistent with the classical algorithm in time( k2 2η 1.5 √
E(d2(vi,vj))
) , where E(d2(vi, vj)) is the average squared distance between two points of the dataset, and
is the tolerance in the distance estimation. From there, we can perform a full round of q-means algorithm and get an
estimate for µ01 · · ·µ0k. With q-means and the new centroids store in the QRAM we can create the state
|ψ0〉 := 1√ n n∑ i=1 |i〉 |l(vi)〉 . (8)
Where l(vi) is the label of the closest centroid to the i-th point. By sampling S ∈ O(d) points from this state we get two things. First, from the frequency fj of the second register we can have an guess of θ0j ← |Cj |/n ∼ fj/S. Then, from the first register we can estimate Σ0j ← ∑ i∈S(vi − µ0j )(vi − µ0j )T . Sampling O(d) points and creating the
state in Equation (8) takes time Õ(dkη) by Theorem 6.11 and the minimum finding procedure described in (Kerenidis et al., 2018).
Techniques illustrated in (Miyahara et al., 2019) can also be used to quantize the CEM algorithm which needs a hardclustering step. Among the different possible approaches, the random and the small EM greatly benefit from a faster algorithm, as we can spend more time exploring the space of the parameters by starting from different initial seeds, and thus avoid local minima of the likelihood.

heading: 6.4 SPECIAL CASES OF GMM.
text: What we presented in the previous section is the most general model of GMM. For simple datasets, it is common to assume some restrictions on the covariance matrices of the mixtures. The translation into a quantum version of the model should be straightforward. We distinguish between these cases:
1. Soft k-means. This algorithm is often presented as a generalization of k-means, but it can actually be seen as special case of EM for GMM - albeit with a different assignment rule. In soft k-means, the assignment function is replaced by a softmax function with stiffness parameter β. This β represents the covariance of the clusters. It is assumed to be equal for all the clusters, and for all dimensions of the feature space. Gaussian Mixtures with constant covariance matrix (i.e. Σj = βI for β ∈ R) can be interpreted as a kind of soft or fuzzy version of k-means clustering. The probability of a point in the feature space being assigned to a certain cluster j is:
rij = e−β‖xi−µi‖ 2∑k l=1 e −β‖xi−µl‖2
where β > 0 is the stiffness parameter. 2. Spherical. In this model, each component has its own covariance matrix, but the variance is uniform in all
the directions, thus reducing the covariance matrix to a multiple of the identity matrix (i.e. Σj = σ2j I for σj ∈ R).
3. Diagonal. As the name suggests, in this special case the covariance matrix of the distributions is a diagonal matrix, but different Gaussians might have different diagonal covariance matrices.
4. Tied. In this model, the Gaussians share the same covariance matrix, without having further restriction on the Gaussian.
5. Full. This is the most general case, where each of the components of the mixture have a different, SDP, covariance matrix.

heading: 6.5 PROOFS
text: Lemma 6.12 (Determinant evaluation). There is an algorithm that, given as input a matrix Σ and a parameter 0 < δ < 1, outputs an estimate log(det(Σ)) such that |log(det(Σ))− log(det(Σ))| ≤ with probability 1− δ in time:
TDet, = Õ ( −2κ(Σ) log(1/δ)nnz(Σ)| log(det(Σ))| ) Proof. In order to apply Theorem 6.1, we need to be sure that all the eigenvalues lie in (σmin, 1). In order to satisfy this condition, we can scale the matrix by a constant factor c, such that Σ′ = Σ/c. In this way, log det(Σ′) = log ∏d i (σi/c). Therefore, log(det(Σ′)) = log(det(Σ)) − log(cd). This will allow us to recover the value of log det(Σ) by using
Theorem 6.1. We apply the Theorem with precision = 1/4 to get an estimate γ such that 12 ≤ γ log(det(Σ)) ≤ 3 2 . Then, to have an estimate with absolute error , we apply Theorem 6.1 with precision ′ = 4γ . This gives us an estimate for log(det(Σ)) with error 2 ′ log(det(Σ)) ≤ in time:
Õ ( −2κ(Σ) log(1/δ)nnz(Σ)| log(det(Σ))| ) .
Lemma 6.13 (Error in the responsibilities of the exponential family). Let vi ∈ Rn be a vector, and let {p(vi|νj)}kj=1 be a set of k probability distributions in the exponential family, defined as p(vi|νj) := hj(vi)exp{oj(νj)TTj(vi) − Aj(νj)}. Then, if we have estimates for each exponent with error , then we can compute each rij such that |rij−rij | ≤√
2k for j ∈ [k].
Proof. The proof follows from rewriting the responsibility of Equation (3) as:
rij := hj(vi) exp{oj(νj)TT (vi)−Aj(νj) + log θj} k∑ l=1 hl(vi) exp{ol(νl)TT (vi)−Al(νl) + log θl} (9)
In this form, it is clear that the responsibilities can be seen a softmax function, and we can use Theorem 6.3 to bound the error in computing this value.
Let Ti ∈ Rk be the vector of the exponent, that is tij = oj(νj)TT (vi) − Aj(νj) + log θj . In an analogous way we define Ti the vector where each component is the estimate with error . The error in the responsibility is defined as |rij − rij | = |σj(Ti) − σj(Ti)|. Because the function σj is Lipschitz continuous, as we proved in Theorem 6.3 with a Lipschitz constant K ≤ √ 2, we have that, |σj(Ti) − σj(Ti)| ≤
√ 2 ∥∥Ti − Ti∥∥. The result follows as∥∥Ti − Ti∥∥ < √k .
Lemma 6.14 (Quantum Gaussian Evaluation). Suppose we have stored in the QRAM a matrix V ∈ Rn×d, the centroid µ ∈ Rd and the covariance matrix Σ ∈ Rd×d of a multivariate Gaussian distribution φ(v|µ,Σ), as well as an estimate for log(det(Σ)). Then for 1 > 0, there exists a quantum algorithm that with probability 1− γ performs the mapping,
• UG, 1 : |i〉 |0〉 → |i〉 |si〉 such that |si − si| < 1, where si = − 12 ((vi − µ) TΣ−1(vi − µ) + d log 2π +
log(det(Σ))) is the exponent for the Gaussian probability density function.
The running time of the algorithm is,
TG, 1 = O
( κ2(Σ)µ(Σ) log(1/γ)
1 η
) . (10)
Proof. We use quantum linear algebra and inner product estimation to estimate the quadratic form (vi−µ)TΣ−1(vi− µ) to error 1. First, we decompose the quadratic form as vTi Σ
−1vi−2vTi Σ−1µ+µTΣ−1µ and separately approximate each term in the sum to error 1/4.
We describe the procedure to estimate µTΣ−1vi = ∥∥Σ−1vi∥∥ ‖µ‖ 〈µ|Σ−1vi〉, the other estimates are obtained similarly. We use the quantum linear algebra subroutines in Theorem 6.8 to construct |Σ−1vi〉 up to error 3 1 in time O(κ(Σ)µ(Σ)log(1/ 3)) and estimate
∥∥Σ−1vi∥∥ up to error 1 in time O(κ(Σ)µ(Σ)log(1/ 3)/ 1) which gives us the mapping |i〉 |0〉 7→ |i〉 |‖Σ−1vi‖〉. We then use quantum inner product estimation (Theorem 6.11) to estimate 〈µ,Σ−1vi〉 to additive error 14‖µ‖‖Σ−1vi‖ . The procedure estimates (µ,Σ −1vi) within additive error 1/4. The pro-
cedure succeeds with probability 1 − γ and requires time O(κ(Σ)µ(Σ) log(1/γ) log(1/ 3) 1 ‖µ‖ ∥∥Σ−1vi∥∥). Using similar estimation procedure for vTi Σ −1µ and µTΣ−1µ, we obtain an estimate for 12 ((vi − µ)
TΣ−1(vi − µ) within error 1. Recall that (through Lemma 3.1) we also have an estimate of the log-determinant to error 1. Thus we obtain an approximation for − 12 ((vi − µ) TΣ−1(vi − µ) + d log 2π + log(det(Σ))) within error 2 1. We have the upper bound,
∥∥Σ−1vi∥∥ ≤ ∥∥Σ−1∥∥ ‖vi‖ ≤ κ(Σ) ‖vi‖, as ‖Σ‖ = 1 for Σ stored in a QRAM data structure. Further observing that ‖u‖ ≤ √η and ‖vi‖ ≤ √ η, the running time for this computation is O ( κ2(Σ)µ(Σ) log(1/γ) log(1/ 3) 1 η ) .
Lemma 6.15 (Calculating responsibilities). Suppose we have quantum access to a GMM with parameters γt = (θt,µt,Σt). There are quantum algorithms that can:
1. Perform the mapping |i〉 |j〉 |0〉 7→ |i〉 |j〉 |rij〉 such that |rij − rij | ≤ 1 with probability 1− γ in time: TR1, 1 = Õ(k 1.5 × TG, 1)
2. For a given j ∈ [k], construct state |Rj〉 such that ∥∥∥∥|Rj〉 − 1√Zj n∑i=0 rij |i〉 ∥∥∥∥ < 1 where Zj = n∑ i=0 r2ij with
high probability in time: TR2, 1 = Õ(k 2 × TR1, 1)
Proof. For the first statement, let’s recall the definition of responsibility: rij = θjφ(vi;µj ,Σj)∑k l=1 θlφ(vi;µl,Σl) . With the aid of UG, 1 of Lemma 3.2 we can estimate log(φ(vi|µj ,Σj)) for all j up to additive error 1, and then using the current estimate of θt, we can calculate the responsibilities create the state,
1√ n n∑ i=0 |i〉 ( k⊗ j=1 |j〉 |log(φ(vi|µj ,Σj)〉 ) ⊗ |rij〉 .
The estimate rij is computed by evaluating a weighted softmax function with arguments log(φ(vi|µj ,Σj) for j ∈ [k]. The estimates log(φ(vi|µj ,Σj) are then uncomputed. The runtime of the procedure is given by calling k times Lemma 3.2 for Gaussian estimation (the arithmetic operations to calculate the responsibilities are absorbed).
Let us analyze the error in the estimation of rij . The responsibility rij is a softmax function with arguments log(φ(vi|µj ,Σj)) that are computed upto error 1 using Lemma 3.2. As the softmax function has a Lipschitz constant K ≤ √ 2 by Lemma 6.13, we choose precision for Lemma 3.2 to be 1/ √ 2k to get the guarantee |rij − rij | ≤ 1. Thus, the total cost of this step is TR1, 1 = k 1.5TG, 1 .
Now let’s see how to encode this information in the amplitudes, as stated in the second claim of the Lemma. We estimate the responsibilities rij to some precision and perform a controlled rotation on an ancillary qubit to obtain,
1√ n |j〉 n∑ i=0 |i〉 |rij〉 ( rij |0〉+ √ 1− rij2 |1〉 ) . (11)
We then undo the circuit on the second register and perform amplitude amplification on the rightmost auxiliary qubit being |0〉 to get |Rj〉 := 1‖Rj‖ ∑n i=0 rij |i〉. The runtime for amplitude amplification on this task is O(TR1, · √ n ‖Rj‖ ).
Let us analyze the precision required to prepare |Rj〉 such that ∥∥|Rj〉 − |Rj〉∥∥ ≤ 1. As we have estimates |rij −
rij | < for all i, j, the `2-norm error ∥∥Rj −Rj∥∥ = √∑ni=0 |rij − rij |2 < √n . Applying Claim 6.4, the error for
the normalized vector |Rj〉 can be bounded as ∥∥|Rj〉 − |Rj〉∥∥ < √2n ‖Rj‖ . By the Cauchy-Schwarz inequality we have
that ‖Rj‖ ≥ ∑n i rij√ n . We can use this to obtain a bound √ n ‖Rj‖ < √ n∑ i rij √ n = O(k), using the dataset assumptions in section 2. If we choose such that √
2n ‖Rj‖ < 1, that is ≤ 1/k then our runtime becomes TR2, 1 := Õ(k 2 × TR1, 1).
Lemma 6.16 (Computing θt+1). We assume quantum access to a GMM with parameters γt and let δθ > 0 be a precision parameter. There exists an algorithm that estimates θ t+1 ∈ Rk such that ∥∥∥θt+1 − θt+1∥∥∥ ≤ δθ in time
Tθ = O
( k3.5η1.5 κ2(Σ)µ(Σ)
δ2θ
)
Proof. An estimate of θt+1j can be recovered from the following operations. First, we use Lemma 3.3 (part 1) to compute the responsibilities to error 1, and then perform the following mapping, which consists of a controlled rotation on an auxiliary qubit:
1√ nk n,k∑ i=1 j=1 |i〉 |j〉 |rijt〉 7→ 1√ nk n,k∑ i=1 j=1 |i〉 |j〉 (√ rij t |0〉+ √ 1− rijt |1〉 ) The previous operation has a cost of TR1, 1 , and the probability of getting |0〉 is p(0) = 1nk ∑n i=1 ∑k j=1 r t ij = 1 k .
Recall that θt+1j = 1 n ∑n i=1 r t ij by definition. Let Zj = ∑n i=1 rij t and define state | √ Rj〉 =(
1√ Zj
∑n i=1 √ rij t |i〉 ) |j〉. After amplitude amplification on |0〉 we have the state,
| √ R〉 := 1√
n n,k∑ i=1 j=1 √ rij t |i〉 |j〉
= k∑ j=1 √ Zj n ( 1√ Zj n∑ i=1 √ rij t |i〉 ) |j〉
= k∑ j=1 √ θj t+1 | √ Rj〉 . (12)
The probability of obtaining outcome |j〉 if the second register is measured in the standard basis is p(j) = θj t+1 .
An estimate for θt+1j with precision can be obtained by either sampling the last register, or by performing amplitude estimation to estimate each of the values θt+1j for j ∈ [k]. Sampling requires O( −2) samples by the Chernoff bounds, but does not incur any dependence on k. In this case, as the number of cluster k is relatively small compared to 1/ , we chose to do amplitude estimation to estimate all θt+1j for j ∈ [k] to error / √ k in time,
Tθ := O
( k · √ kTR1, 1 ) . (13)
Let’s analyze the error in the estimation of θt+1j . For the error due to responsibility estimation by Lemma 3.3 we have |θj t+1 − θt+1j | = 1n ∑ i |rij t − rtij | ≤ 1 for all j ∈ [k], implying that ∥∥∥θt+1 − θt+1∥∥∥ ≤ √k 1. The total error in `2 norm due to Amplitude estimation is at most as it estimates each coordinate of θj t+1 to error / √ k. Using the triangle inequality, we have the total error is at most + √ k 1. As we require that the final error be upper
bounded as ∥∥∥θt+1 − θt+1∥∥∥ < δθ, we choose parameters √k 1 < δθ/2 ⇒ 1 < δθ2√k and < δθ/2. With these parameters, the overall running time of the quantum procedure is Tθ = O(k1.5 TR1, 1 ) = O ( k3.5 η
1.5·κ2(Σ)µ(Σ) δ2θ
) .
Lemma 6.17 (Computing µt+1j ). We assume we have quantum access to a GMM with parameters γt. For a precision parameter δµ > 0, there is a quantum algorithm that calculates {µjt+1}kj=1 such that for all j ∈ [k]∥∥µjt+1 − µt+1j ∥∥ ≤ δµ in time
Tµ = Õ
( kdηκ(V )(µ(V ) + k3.5η1.5κ2(Σ)µ(Σ))
δ3µ
)
Proof. The new centroid µt+1j is estimated by first creating an approximation of the state |Rtj〉 up to error 1 in the `2- norm using part 2 of Lemma 3.3. We then use the quantum linear algebra algorithms in Theorem 6.8 to multiplyRj by
V T , and compute a state |µjt+1〉 along with an estimate for the norm ∥∥V TRtj∥∥ = ∥∥µjt+1∥∥ with error norm. The last step of the algorithm consists in estimating the unit vector |µjt+1〉 with precision tom using tomography. Considering that the tomography depends on d, which we expect to be bigger than the precision required by the norm estimation, we can assume that the runtime of the norm estimation is absorbed. Thus, we obtain: Õ ( k d 2tom · κ(V ) (µ(V ) + TR2, 1) ) .
Let’s now analyze the total error in the estimation of the new centroids, which we want to be δµ. For this purpose, we use Claim 6.5, and choose parameters such that 2 √ η( tom + norm) = δµ. Since the error 3 for quantum linear algebra appears as a logarithmic factor in the running time, we can choose 3 tom without affecting the runtime.
Let µ be the classical unit vector obtained after quantum tomography, and |̂µ〉 be the state produced by the quantum linear algebra procedure starting with an approximation of |Rtj〉. Using the triangle inequality we have ‖|µ〉 − µ‖ <∥∥∥µ− |̂µ〉∥∥∥ + ∥∥∥|̂µ〉 − |µ〉∥∥∥ < tom + 1 < δµ/2√η. The errors for the norm estimation procedure can be bounded similarly as | ‖µ‖ − ‖µ‖| < | ‖µ‖ − ‖̂µ‖|+ |‖µ‖ − ‖̂µ‖| < norm + 1 ≤ δµ/2 √ η. We therefore choose parameters
tom = 1 = norm ≤ δµ/4 √ η. Since the amplitude estimation step we use for estimating the norms does not depends on d, which is expected to dominate the other parameters, we omit the amplitude estimation step. Substituting for TR2,δµ , we have the more concise expression for the running time of:
Õ
( kdηκ(V )(µ(V ) + k3.5η1.5κ2(Σ)µ(Σ))
δ3µ
) (14)
Lemma 6.18 (Computing Σt+1j ). We assume we have quantum access to a GMM with parameters γt. We also have computed estimates µjt+1 of all centroids such that ∥∥µjt+1 − µt+1j ∥∥ ≤ δµ for precision parameter δµ > 0. Then, there exists a quantum algorithm that outputs estimates for the new covariance matrices {Σt+1j }kj=1 such that∥∥∥Σt+1j − Σt+1j ∥∥∥
F ≤ δµ
√ η with high probability, in time,
TΣ := Õ (kd2ηκ2(V )(µ(V ′) + η2k3.5κ2(Σ)µ(Σ))
δ3µ ) Proof. It is simple to check, that the update rule of the covariance matrix during the maximization step can be reduced to (Murphy, 2012, Exercise 11.2):
Σt+1j ← ∑n i=1 rij(vi − µ t+1 j )(vi − µ t+1 j )
T∑n i=1 rij =
∑n i=1 rijviv T i
nθj − µt+1j (µ t+1 j ) T = Σ′j − µt+1j (µ t+1 j ) T (15)
First, note that we can use the estimates of the centroids to compute µt+1j (µ t+1 j ) T with error δµ ‖µ‖ ≤ δµ √ η in
the update rule for the Σj . This follows from the fact that µ = µ + e where e is a vector of norm δµ. Therefore∥∥µµT − µ µT∥∥ < 2√ηδµ + δ2µ ≤ 3√ηδµ. It follows that we can allow an error of √ηδµ also for the left term in the definition of Σt+1j . Let’s discuss the procedure for estimating Σ ′ j in Eq. (15). Note that vec[Σ ′ j ] = (V
′)TRj , so we use quantum matrix multiplication to estimate |vec[Σ′j ]〉 and ∥∥vec[Σ′j ]∥∥. As the runtime for the norm estimation κ(V ′)(µ(V ′)+TR2, 1 )) log(1/ mult)
norms does not depend on d, we consider it smaller than the runtime for performing
tomography. Thus, the runtime for this operation is:
O( d2 log d
2tom κ(V ′)(µ(V ′) + TR2, 1)) log(1/ mult)).
Let’s analyze the error of this procedure. We want a matrix Σ′j that is √ ηδµ-close to the correct one: ∥∥∥Σ′j − Σ′j∥∥∥ F
=∥∥∥vec[Σ′j ]− vec[Σ′j ]∥∥∥ 2 < √ ηδµ. Again, the error due to matrix multiplication can be taken as small as necessary,
since is inside a logarithm. From Claim 6.5, we just need to fix the error of tomography and norm estimation such that η( unit + norms) < √ ηδµ where we have used η as an upper bound on ‖Σj‖F . For the unit vectors, we require∥∥∥|Σ′j〉 − |Σ′j〉∥∥∥ ≤ ∥∥∥|Σ′j〉 − |̂Σ′j〉∥∥∥+∥∥∥|̂Σ′j〉 − |Σ′j〉∥∥∥ < tom+ 1 ≤ δµ/2√η, where |Σ′j〉 is the error due to tomography and |̂Σ′j〉 is the error due to Lemma 3.3. For this inequality to be true, we choose tom = 1 < δµ/4 √ η.
The same argument applies to estimating the norm ∥∥Σ′j∥∥ with relative error : |∥∥Σ′j∥∥ − ∥∥Σ′j∥∥| ≤ |∥∥Σ′j∥∥ − ∥̂∥Σ′j∥∥| +
| ∥̂∥Σ′j∥∥− ∥∥Σ′j∥∥ | < + 1 ≤ δµ/2√η (where here is the error of the amplitude estimation step used in Theorem 6.8 and 1 is the error in calling Lemma 3.3. Again, we choose = 1 ≤ δµ/4 √ η. Note that κ(V ′) ≤ κ2(V ). This can be derived from the fact that κ(A⊗B) = κ(A)κ(B), κ(AB) ≤ κ(A)κ(B), and
V ′ :=  [e1 ⊗ e1] T
... [en ⊗ en]T  (V ⊗ V ). Since the tomography is more costly than the amplitude estimation step, we can disregard the runtime for the norm estimation step. As this operation is repeated k times for the k different covariance matrices, the total runtime of the whole algorithm is given by Õ ( kd2ηκ2(V )(µ(V ′)+η2k3.5κ2(Σ)µ(Σ))
δ3µ
) .
Let us also note that for each of new computed covariance matrices, we use Lemma 3.1 to compute an estimate for their log-determinant and this time can be absorbed in the time TΣ.
Lemma 6.19 (Quantum estimation of likelihood). We assume we have quantum access to a GMM with parameters γt. For τ > 0, there exists a quantum algorithm that estimates E[p(vi; γt)] with absolute error τ in time
T` = Õ
( k1.5η1.5 κ2(Σ)µ(Σ)
2τ ) Proof. We obtain the likelihood from the ability to compute the value of a Gaussian distribution and quantum arithmetic. Using the mapping of Lemma 3.2 with precision 1, we can compute φ(vi|µj ,Σj) for all the Gaussians, that is |i〉 ⊗k−1 j=0 |j〉 |p(vi|j; γj)〉. Then, by knowing θ, and by using quantum arithmetic we can compute in a register
the mixture of Gaussian’s: p(vi; γ) = ∑ j∈[k] θjp(vi|j; γ). We now drop the notation for the model γ and write p(vi) instead of p(vi; γ). Doing the previous calculations quantumly leads to the creation of the state |i〉 |p(vi)〉. We perform the mapping |i〉 |p(vi)〉 7→ |i〉 (√ p(vi)| |0〉+ √ 1− p(vi) |1〉 ) and estimate p(|0〉) ' E[p(vi)] with
amplitude estimation on the ancilla qubit. To get a τ -estimate of p(0) we need to decide the precision parameter we use for estimating p(vi|j; γ) and the precision required by amplitude estimation. Let p(0) be the 1-error introduced by using Lemma 3.2 and p̂(0) the error introduced by amplitude estimation. Using triangle inequality we set∥∥∥p(0)− p̂(0)∥∥∥ < ∥∥∥p̂(0)− p(0)∥∥∥+ ∥∥∥p(0)− p(0)∥∥∥ < τ . To have |p(0) − p̂(0)| < τ , we should set 1 such that |p(0) − p(0)| < τ/4, and we set the error in amplitude estimation and in the estimation of the probabilities to be τ/2. The runtime of this procedure is therefore:
Õ ( k · TG, τ ·
1 τ √ p(0)
) = Õ ( k1.5η1.5 · κ(Σ)µ(Σ)
2τ
)

heading: 6.6 EXPERIMENTS
text: We used a subset of the voices that can be found on VoxForge (Voxforge.org). The training set consist in 5 speech utterances for 34 speakers (i.e. clips of a few seconds of voice speech). From this data, it is common in the speech
recognition community to extract the so-called Mel Frequency Cepstrum Coefficients (MFCCs) features (Reynolds et al., 2000). We selected d = 40 features for each speaker. Then, each speaker is modeled with a mixture of 16 different Gaussians. The test set consists of other 5 unseen utterances of the same 34 speakers (i.e. the training set and the test set have the same size). The task is to correctly label the unseen utterances with the name of the correct speaker. This is done by testing each of the GMM fitted during the training with the new voice sample, and selecting the model with the highest likelihood. Due to the differences in the speakers’ audio data, the different dataset V1 . . . V34 are made of a variable number of points which ranges from n = 2000 to 4000.
In the vanilla configuration without thresholding, 169 among 170 utterances (5 utterances for all 34 speakers) were correctly labeled by EM with ML estimate, while all the elements in the test set were correctly recognized using the Bayesian (MAP) framework. During the training, we measured all the values of κ(Σ), κ(V ), µ(V ), µ(Σ). For almost all GMM fitted (choosing a diagonal covariance matrix), there is at least a Σj (among the 16 used to model a single speaker) with bad condition number (i.e up to 2500 circa). As in (Kerenidis et al., 2018; Kerenidis & Luongo, 2018) we took a threshold on the matrix by discarding singular values smaller than a certain value m. Practically, we discarded any singular value smaller than 2×10−2. Thresholding the covariance matrices did not impact the accuracy (the generalization error) significantly. In the MAP estimate, only one element is not correctly classified, while this number goes up to two in the case of ML estimates. The results are in Table 1.
To check the resistence to noise, we perturbed each of the GMM γt, once fitted. Then, we measured variations of the accuracy on the test set. For each model, the perturbation consists of three things. First we add to θ a uniform vector (with randomly selected negative or positive entries) of `2 norm of δθ = 0.035. Then we perturb each centroid µj with a vector of norm smaller than δµ = 0.5. In this error vector the sign of each noise component is chosen randomly, and the magnitude is sampled uniformly in the interval (0, δµ√
d ). Then, we perturbed also the diagonal matrices Σj with a
vector of norm smaller than δµ √ η, where η = 10. As we are using a diagonal GMM, this reduces to perturbing each singular value by some random noise upper bounded by ±δµ √ η/ √ d, making sure that each of the singular value stays positive, as covariance matrices are SPD. Last, the matrices are thresholded. Since the representation of the model used by our software stores the Cholesky’s decomposition of the inverse, we worked with that representation. Notably, thresholding the Σj help to mitigate the error of noise and regularize the model. With these parameters, we were able to correctly label 167 utterances over 170. We leave for the future further experiments with bigger and different types of datasets or where the noise is also added during the training process. We used scikit-learn (Pedregosa et al., 2011) to run all the experiments.

heading: 6.7 QUANTUM MAP ESTIMATE OF GMM
text: Maximum Likelihood is not the only way to estimate the parameters of a model, and in certain cases might not even be the best one. For instance, in high-dimensional spaces, it is pretty common for ML estimates to overfit. Moreover, it is often the case that we have prior information on the distribution of the parameters, and we would like our models to take this information into account. These issues are often addressed using a Bayesian approach, i.e. by using a so-called Maximum A Posteriori estimate (MAP) of a model (Murphy, 2012, Section 14.4.2.8). MAP estimates work by assuming the existence of a prior distribution over the parameters γ. The posterior distribution we use as objective function to maximize comes from the Bayes’ rule applied on the likelihood, which gives the posterior as a product of the likelihood and the prior, normalized by the evidence. More simply, we use the Bayes’ rule on the likelihood function, as p(γ;V ) = p(V ;γ)p(γ)p(V ) . This allows us to treat the model γ as a random variable, and derive from the ML estimate a MAP estimate:
γ∗MAP = arg max γ n∑ i=1 log p(γ|vi) (16)
Among the advantages of a MAP estimate over ML is that it avoids overfitting by having a kind of regularization effect on the model (Murphy, 2012, Section 6.5). Another feature consists in injecting into a maximum likelihood model some external information, perhaps from domain experts. This advantage comes at the cost of requiring “good” prior information on the problem, which might be non-trivial. In terms of labelling, a MAP estimates correspond to a hard
clustering, where the label of the point vi is decided according to the following rule:
yi = arg max j rij = arg max j
log p(vi|yi = j; γ) + log p(yi = j; γ) (17)
Deriving the previous expression is straightforward using the Bayes’ rule, and by noting that the softmax is rankpreserving, and we can discard the denominator of rij - since it does not depend on γ - and it is shared among all the other responsibilities of the points vi. Thus, from Equation 16 we can conveniently derive Equation 17 as a proxy for the label. Fitting a model with MAP estimate is commonly done via the EM algorithm as well. The Expectation step of EM remains unchanged, but the update rules of the Maximization step are slightly different. In this work we only discuss the GMM case, for the other cases the interested reader is encouraged to see the relevant literature. For GMM, the prior on the mixing weight is often modeled using the Dirichlet distribution, that is θj ∼ Dir(α). For the rest of parameters, we assume that the conjugate prior is of the form p(µj ,Σj) = NIW (µj ,Σj |m0, ι0, ν0,S0), where NIW(µj ,Σj) is the Normal-inverse-Wishart distribution. The probability density function of the NIW is the product between a multivariate normal φ(µ|m0, 1ιΣ) and a inverse Wishart distribution W
−1(Σ|S0, ν0). NIW has as support vectors µ with mean µ0 and covariance matrices 1ιΣ where Σ is a random variable with inverse Wishart distribution over positive definite matrices. NIW is often the distribution of choice in these cases, as is the conjugate prior of a multivariate normal distribution with unknown mean and covariance matrix. A shorthand notation, let’s define rj = nθj = ∑n i=1 rij . As in (Murphy, 2012), we also denote with xj t+1 and Sj t+1
the Maximum Likelihood estimate of the parameters (µt+1j )ML and (Σ t+1 j )ML. For MAP, the update rules are the following:
θt+1j ← rj + αj − 1 n+ ∑ j αj − k
(18)
µt+1j ← rjxj t+1 + ι0m0 rj + ι0
(19)
Σt+1j ← S0 + Sj
t+1 + ι0rj ι0+rj (xj t+1 −m0)(xjt+1 −m0)T
ν0 + rk + d+ 2 (20)
Where the matrix S0 is defined as:
S0 := 1
k1/d Diag(s21, · · · , s2d), (21)
where each value sj is computed as sj := 1n ∑n i=1(xij − ∑n i=1 xij))
2 which is the pooled variance for each of the dimension j. For more information on the advantages, disadvantages, and common choice of parameters of a MAP estimate, we refer the interested reader to (Murphy, 2012). Using the QEM algorithm to fit a MAP estimate is straightforward, since once the ML estimate of the parameter is recovered from the quantum procedures, the update rules can be computed classically.
Corollary 6.20 (QEM for MAP estimates of GMM). We assume we have quantum access to a GMM with parameters γt. For parameters δθ, δµ, τ > 0, the running time of one iteration of the Quantum Maximum A Posteriori (QMAP) algorithm algorithm is
O(Tθ + Tµ + TΣ + T`),
for
Tθ = Õ
( k3.5η1.5 κ2(Σ)µ(Σ)
δ2θ ) Tµ = Õ ( kdηκ(V )(µ(V ) + k3.5η1.5κ2(Σ)µ(Σ))
δ3µ ) TΣ = Õ
(kd2ηκ2(V )(µ(V ′) + η2k3.5κ2(Σ)µ(Σ)) δ3µ ) T` = Õ ( k1.5η1.5 κ2(Σ)µ(Σ)
2τ ) For the range of parameters of interest, the running time is dominated by TΣ.

Review summaries:
The authors present a quantum algorithm for expectation maximization on a quantum machine, which is poly-logarithmic in the size of the dataset (and polynomial in other parameters such as the dimension of the feature space, and number of mixture components, condition number of the data and covariance matrices, some precision/error parameters etc) per iteration. So, compared to the . regular EM algorithm, this yields exponential speedup in the number of data points, but is worse in other factors (such as a k^4.5 dependence on the number of mixture components). So, the quantum system could be superior to a conventional computer for some settings of parameters. They run some (simulation) experiments on a dataset (VoxForge) to report accuracies (though there is no comparison of the accuracy of the classical algorithm). Also, there does not seem to be any experimental results to confirm the theoretical analysis of the scaling characteristics (i.e., to show that the scaling is as predicted by the theory).