CoinPress: Practical Private Mean and Covariance Estimation
Sourav Biswas, Yihe Dong, Gautam Kamath, Jonathan Ullman
Introduction
One of the most basic problems in statistics and machine learning is to estimate the mean and covariance of a distribution based on i.i.d. samples. Not only are these some of the most basic summary statistics one could want for a real-valued distribution, but they are also building blocks for more sophisticated statistical estimation tasks like linear regression and stochastic convex optimization.
The optimal solutions to these problems are folklore—simply output the empirical mean and covariance of the samples. However, this solution is not suitable when the samples consist of sensitive, private information belonging to individuals, as it has been shown repeatedly that even releasing just the empirical mean can reveal this sensitive information [DN03, HSR+08, BUV14, DSS+15, DSSU17]. Thus, we need estimators that are not only accurate with respect to the underlying distribution, but also protect the privacy of the individuals represented in the sample.
The most widely accepted solution to individual privacy in statistics and machine learning is differential privacy (DP) [DMNS06], which provides a strong guarantee of individual privacy by ensuring that no individual has a significant influence on the learned parameters. A large body of work now shows that, in principle, nearly every statistical task can be solved privately, and differential privacy is now being deployed by Apple [Dif17], Google [EPK14, BEM+17], Microsoft [DKY17], and the US Census Bureau [DLS+17].
Differential privacy requires adding random noise to some stage of the estimation procedure, and this noise might increase the error of the final estimate. Typically, the amount of noise vanishes as the sample size grows, and one can often show that as , the additional error due to privacy vanishes faster than the sampling error of the estimator, making differential privacy highly practical for large samples.
However, differential privacy is often difficult to achieve for small datasets, or when the dataset is large, but we want to restrict attention to some small subpopulation within the data. Thus, a recent trend has been to focus on simple, widely used estimation tasks, and design estimators with good concrete performance at small samples sizes. Most relevant to our work, Karwa and Vadhan [KV18] and Du, Foot, Moniot, Bray, and Groce [DFM+20] give practical mean and variance estimators for univariate Gaussian data. However, as we show, these methods do not scale well to the more challenging multivariate setting.
In this work we give simple, practical estimators for the mean and covariance of multivariate sub-Gaussian data. We call our method CoinPress, for COnfidence-INterval-based PRivate EStimation Strategy. We validate our estimators theoretically and empirically. On the theoretical side, we show that our estimators match the state-of-the-art asymptotic bounds for sub-Gaussian mean and covariance estimation [KLSU19]. On the empirical side, we give an extensive evaluation with synthetic data, as well as a demonstration on a real-world dataset. We show that our estimators have error comparable to that of the non-private empirical mean and covariance at small sample sizes. See Figure 1 for one representative example of our algorithm’s performance. Our mean estimator also improves over the state-of-the-art method of Du et al. [DFM+20], which was developed for univariate data but can be applied coordinate-wise to estimate multivariate data. We highlight a few other important features of our methods:
First, like many differentially private estimators, our method requires the user to input some a priori knowledge of the data. For mean estimation, we require the mean lives in a specified ball of radius , and for covariance estimation we require that the covariance matrix can be sandwiched spectrally between and for some matrix . Some a priori boundedness is necessary for algorithms like ours that satisfy concentrated DP [DR16, BS16, Mir17, BDRS18], or satisfy pure DP. Under pure or concentrated DP, the dependence on and must be polylogarithmic [KV18, BKSW19]. One can allow for mean estimation under -DP with [KV18], although the resulting algorithm has poor concrete performance even for univariate data. It is an open question whether one can allow for covariance estimation even under -DP. We show that our estimator is practical when these parameters are taken to be extremely large, meaning the user only needs a very weak prior.
Second, for simplicity, we describe and evaluate our methods primarily with Gaussian data. However, the only feature of Gaussian data that is relevant for our methods is a strong bound on the tails of the distribution, and, by definition, these bounds hold for any sub-Gaussian distribution. Moreover, using experiments with both heavier-tailed synthetic data and with real-world data, we demonstrate that our method remains useful even when the data is not truly Gaussian. Note that some restriction on the details of the data is necessary, at least in the worst-case, as [KSU20] showed that the minimax optimal error is highly sensitive to the rate of decay of the distribution’s tails.
Approach. At a high-level, our estimators work by iteratively refining an estimate for the parameters, inspired by [KLSU19]. For mean estimation, we start with some (potentially very large) ball of radius that we know contains most of the mass of the probability distribution. We then use this ball to run a naïve estimation procedure: clip the data to the ball , then add noise to the empirical mean of the clipped data to obtain some initial estimate of the mean. Specifically, the noise will have magnitude proportional to . Using this estimate, and knowledge of how we obtainesd it, we can draw a (hopefully significantly smaller) ball of radius that contains most of the mass and then repeat. After a few iterations, we will have some ball of radius that tightly contains most of the datapoints, and use this to make an accurate final private estimate of the mean with noise proportional to . Our covariance estimation uses the same iterative approach, although the geometry is significantly more subtle.
2 Problem Formulation
An estimator satisfies -zCDP if for every pair of neighboring samples of size , and every , , where is the Rényi divergence of order .
This formulation sits in between general -differential privacy and the special case of -differential privacy, Formally, -DP -zCDP -DP for every and better captures the privacy cost of private algorithms in high dimension [DSSU17].
We assume that our algorithms are given some a priori estimate of the mean in the form of a radius such that and some a priori estimate of the covariance in the form of such that , (equivalently all the singular values of lie between and ). We repeat that some a priori bound on is necessary for any algorithm that satisfies zCDP [BS16, KV18].
We measure the error in Mahalanobis distance , which reports how the error compares to the covariance of the distribution, and has the benefit of being invariant under affine transformations. Specifically,
For any distribution, the empirical mean and empirical covariance satisfy
and these estimators are minimax optimal. Our goal is to obtain estimators that have similar accuracy to the empirical mean and covariance. We note that the folklore naïve estimators (see e.g. [KV18, KLSU19]) for mean and covariance based on clipping the data to an appropriate ball and adding carefully calibrated noise to the empirical mean and covariance would guarantee
The main downside of the naïve estimators is their error increases rapidly with and , and thus introduce large error unless the user has strong a priori knowledge of the mean and covariance. Requiring users to provide such a priori bounds is a major challenge in deployed systems for differentially private analysis (e.g. [GHK+16]). Our estimators have much better dependence on these parameters, both asymptotically and concretely.
For our theoretical analysis and most of our evaluation, we derive bounds on the error of our estimators assuming is specifically the Gaussian . Although, as we show in some of our experiments, our methods perform well even when we relax this assumption.
3 Related Work
The most relevant line of work is that initiated by Karwa and Vadhan [KV18], which studies private mean and variance estimation for Gaussian data, and focuses on important issues for practice like dealing with weak a priori bounds on the parameters. Later works studied the multivariate setting [KLSU19, CWZ19, KSSU19] and estimation under weaker moment assumptions [BS19, KSU20], though these investigations are primarily theoretical. Our algorithm for covariance estimation can be seen as a simpler and more practical variant of [KLSU19]. They provide an iterative procedure which, based on a privatized finds the subspaces of high and low variance they iteratively threshold eigenvalues to find directions of high and low variance, whereas we employ a softer method to avoid wasting information. One noteworthy work is [DFM+20], which provides practical private confidence intervals in the univariate setting. Instead, our investigation is focused on realizable algorithms for the multivariate setting. Several works consider private PCA or covariance estimation [DTTZ14, HP14, ADK+19], though, unlike our work, these methods assume strong a priori bounds on the covariance.
Other approaches for Gaussian estimation include [NRS07], which introduced the sample-and-aggregate paradigm, and [BKSW19] which employs a private hypothesis selection method. Zhang, Kamath, Kulkarni, and Wu privately estimate Markov Random Fields [ZKKW20], a generalization of product distributions over the hypercube. Dwork and Lei [DL09] introduced the propose-test-release framework for estimating robust statistics such as the median and interquartile range. For further coverage of private statistics, see [KU20].
Preliminaries
We begin by recalling the definition of differential privacy, and the variant of concentrated differential privacy that we use in this work.
A randomized algorithm satisfies -differential privacy (-DP) if for every pair of neighboring datasets (i.e., datasets that differ in exactly one entry),
When , we say that satisfies -differential privacy or pure differential privacy.
A randomized algorithm satisfies -zCDP if for every pair of neighboring datasets ,
where D_{\alpha}\mathopen{}\mathclose{{\left(M(X)||M(X^{\prime})}}\right) is the -Rényi divergence between and . Given two probability distributions over , D_{\alpha}(P\|Q)=\frac{1}{\alpha-1}\log\mathopen{}\mathclose{{\left(\sum_{x}P(x)^{\alpha}Q(x)^{1-\alpha}}}\right).
Note that zCDP and DP are on different scales, but otherwise can be ordered from most-to-least restrictive. Specifically, -DP implies -zCDP, which implies roughly -DP for every [BS16].
Both these definitions are closed under post-processing and can be composed with graceful degradation of the privacy parameters.
If is -DP, and is any randomized function, then the algorithm is -DP. Similarly if is -zCDP then the algorithm is -zCDP.
If is an adaptive composition of differentially private algorithms , then
if are -DP then is -DP, and
if are -zCDP then is -zCDP.
We can achieve differential privacy via noise addition proportional to sensitivity [DMNS06].
New Algorithms for Multivariate Gaussian Estimation
In this section, we present new algorithms for Gaussian parameter estimation. While these do not result in improved asymptotic sample complexity bounds, they will lead to algorithms which are much more practical in the multivariate setting. In particular, they will avoid the curse of dimensionality incurred by multivariate histograms, but also eschew many of the hyperparameters that arise in previous methods [KLSU19]. Note that our algorithms with precisely describe the naïve method that was informally outlined in Section 1.2. We describe the algorithms and sketch ideas behind the proofs, which appear in the appendix. Also in the appendix, we describe simpler univariate algorithms in the same style. Understanding these algorithms and proofs first might be helpful before approaching algorithms for the multivariate setting.
We first present our multivariate private mean estimation algorithm MVMRec (Algorithm 2). This is an iterative algorithm, which maintains a confidence ball that contains the true mean with high probability. For ease of presentation, we state the algorithm for a Gaussian with identity variance. However, by rescaling the data, the same argument works for an arbitrary known covariance . In fact, the covariance doesn’t even need to be known exactly – we just need a proxy such that , where are absolute constants.
It remains to reason about MVM. We need to argue (a) privacy and (b) accuracy: given , it is likely to output ; and c) progress: the radius output is much smaller than the input. The algorithm first chooses some and clips the data to . is chosen based on Gaussian tail bounds such that if , then none of the points will be affected by this operation. This bounds the sensitivity of the empirical mean, and applying the Gaussian mechanism guarantees privacy. While the noised mean will serve as a point estimate , we actually have more: again using Gaussian tail bounds on the data combined with the added noise, we can define a radius such that , establishing accuracy. Finally, a large enough will ensure , establishing progress. Since each step reduces our radius by a constant factor, setting will reduce the initial radius from to as desired. Formalizing this gives the following theorem.
2 Multivariate Private Covariance Estimation
We describe our multivariate private covariance estimation algorithm MVCRec (Algorithm 4). The ideas are conceptually similar to mean estimation, but subtler due to the more complex geometry. We assume data is drawn from where for some known . One can reduce to the zero-mean case by differencing pairs of samples. Further, if we know some PSD matrix such that then we can rescale the data by .
To specify the algorithm we need a couple of tail bounds on the norm of points from a normal distribution, the spectral-error of the empirical covariance, and the spectrum of a certain random matrix. As these expressions are somewhat ugly, we define them outside of the pseudocode. In these expressions, we fix parameters .
Similar to MVMRec, MVCRec repeatedly calls a private algorithm (MVC) that makes a constant-factor progress (with respect to some appropriate measure), and then runs the naïve algorithm (i.e., clip the data and noise the empirical covariance matrix). Rather than maintaining a ball containing the true mean, we maintain an ellipsoid (described via a PSD matrix) that upper bounds the true covariance in the Loewner order. For mathematical convenience, we work in a scaled version of the original space. That is, after each step, we rescale the problem so that this upper bound is the identity matrix, which simplifies reasoning about and describing the clipping procedure and noising mechanism. Progress holds with respect to the original problem in the unscaled domain: roughly speaking, either the upper bound on the variance in a direction decreases by a constant factor, or if this upper bound is already tight up to a constant factor, then the upper bound increases only slightly. As the upper and lower bounds on the variance in each direction are off by a factor of , we show that iterations suffice to get an upper bound which is at most a constant factor larger than the true covariance in each direction. At this point, we can apply the naïve clip-and-noise algorithm, which is accurate given enough samples.
The algorithm MVC is similar to MVM. We first clip the points at a distance based on Gaussian tail bounds with respect to the outer ellipsoid, which is unlikely to affect the dataset when it dominates the true covariance. After this operation, we can show that the sensitivity of an empirical covariance statistic is bounded using the following lemma. [KLSU19] proved a similar statement without an explicit constant, but the optimal constant is important in practice.
Applying the Gaussian mechanism (à la [DTTZ14]) in combination with this sensitivity bound, we again get a private point estimate for the covariance, and can also derive a confidence ellipsoid upper bound. This time we require more sophisticated tools, including confidence intervals for the spectral norm of both a symmetric Gaussian matrix and the empirical covariance matrix of Gaussian data. Using a valid confidence ellipsoid ensures accuracy, and a sufficiently large again results in a constant factor squeezing of the ellipsoid, guaranteeing progress.
Putting together the analysis leads to the following theorem.
Conclusions
We provided the first effective and realizable algorithms for differentially private estimation of mean and covariance in the multivariate setting. We demonstrated that not only do these algorithms have strong theoretical guarantees (matching the state-of-the-art), but they are also accurate even at relatively low sample sizes and high dimensions. They significantly outperform all prior methods, possess few hyperparameters, and remain precise even when given minimal prior information about the data. In addition, we showed that our methods can be used for a private version of PCA, a task which is common in data science and exploratory data analysis. As we are seeing the rise of a number of new libraries for practical differentially private statistics and data analysis [The20, ABW20] we believe our results add an important tool to the toolkit for the multivariate setting.
Acknowledgments
GK thanks Aleksandar Nikolov for useful discussions about the proof of Lemma 3.2, and Argyris Mouzakis for pointing out a gap in a previous proof of Theorem 3.3.
References
Appendix A New Algorithms for Univariate Gaussian Parameter Estimation
In this section, we present our algorithms for estimating the mean and variance of a univariate Gaussian. We will write all our algorithms to give zCDP privacy guarantees, but the same approach can give pure DP algorithms in the univariate setting. One must simply switch Gaussian to Laplace noise, swap in the appropriate tail bounds for the confidence interval, and apply basic composition rather than zCDP composition.
We start with our univariate private mean estimation algorithm UVMRec (Algorithm 6). The guarantees are presented in Theorem A.1, note that the sample complexity is optimal in all parameters up to logarithmic factors [KV18]. While our algorithm and results are stated for a Gaussian with known variance, the same guarantees hold if the algorithm is only given the true variance up to a constant factor. Algorithm 6 is an iterative invocation of Algorithm 5, each step of which makes progress by shrinking our confidence interval for where the true mean lies. This is the simplest instantiation of our general algorithmic formula. Additionally, our proof of correctness is spelled out in full detail for this case – as the other proofs follow an almost identical structure, we only describe the differences.
We start by proving privacy. Observe that by application of the Gaussian mechanism (Lemma 2.6) in Line 4 of Algorithm 5, this algorithm is -zCDP. Privacy of Algorithm 6 follows by composition of zCDP (Lemma 2.4).
We start by analyzing the iterations of the Line 3, each of which calls Algorithm 5. We prove two properties of this algorithm. Informally, it will always create a valid confidence interval, and the confidence interval shrinks by a constant factor. More formally:
A.2 Univariate Private Variance Estimation
Overall, the proof is very similar to that of Theorem A.1, so we only highlight the differences. First, we note that the proof of privacy is identical, via the Gaussian mechanism and composition of zCDP.
Appendix B Missing Proofs from Section 3
The proof is very similar to that of Theorem A.1, so we assume familiarity with that and only highlight the differences. First, we note that the proof of privacy is identical, via the Gaussian mechanism and composition of zCDP.
B.2 Proof of Lemma 3.2
Suppose the datasets differ in that one contains a point which is replaced by the point in the other dataset.
The first inequality is since , for any positive semi-definite matrices and .
B.3 Proof of Theorem 3.3
Privacy again follows from the Gaussian mechanism and composition of zCDP. Note that this time, the sensitivity bound is not obvious – the analysis depends on Lemma 3.2.
To argue the utility guarantee of this procedure, we reason about the quantity , which is the “scaling matrix” obtained at the end of the th iteration. We rewrite as the product , where is the matrix obtained in Line 9 of the th call to MVC. Specifically, we will argue that
for to with probability at least . Note that, while the relationship is trivial, the crucial aspects of this set of inequalities are that is explicitly known after the th call, serves as a valid upper bound for , and is not too loose an upper bound on .
We prove this by induction. Starting with , we know that by definition, and thus . By assumption in the theorem statement, we know that . Furthermore, trivially, and thus the base case holds with probability .
Next, we take the inductive step, where we assume the statement holds for , and prove it for . By the inductive hypothesis, with probability at least , which we condition on. The analysis is similar to before: we bound the probability that a point gets adjusted in Line 3 using Fact C.2. We bound the spectral norm of the error due to sampling and the Gaussian noise matrix using Lemma C.3 and C.4, respectively. Combined, these give us that
with probability at least . Taking a union bound with the failure event from the induction hypothesis will give us the desired success probability of at least , as the rest of the argument will be non-probabilistic in nature.
Focusing on the inequality , and multiplying both sides on the left and right by , we get
which is the first inequality we set out to prove.
It only remains to prove . Given the expressions of , and our choice of , we can bound by , and thus
We substitute this upper bound on into , giving
At this point, we apply the upper bound of the induction hypothesis:
Now, similar to before, we inspect the final call in Line 6. We have the following with probability at least :
The first inequality is by assumption. The second and third are by (3) and the setting of . The final inequality uses the first inequality. Rearranging terms, we have that
With this in place, analysis follows similarly to Lemma 3.6 of [KLSU19]. Sketching the argument: our condition on implies that the Frobenius norm of both the empirical covariance and the noise added will be bounded by . Rescaling by the scaling matrix gives the desired result.
Appendix C Concentration Inequalities and Tail Bounds
If , then .
If is a chi-squared random variable with degrees of freedom, then and . Thus, if , then .
We also need the following bound on the spectral error of an empirical covariance matrix.
Finally, we need a bounds on the spectral norm of a symmetric matrix with random Gaussian entries.
Let be the matrix where for , and for . Then with probability at least , we have the following bound:
First, we have the following bound on the expectation of the spectral norm:
This is from Theorem 1.1 of [BVH16], fixing the value of . The desired tail bound follows since the spectral norm is -Lipschitz for this class of symmetric matrices, and by Gaussian concentration of Lipschitz functions (e.g., Proposition 5.34 of [Ver12]). ∎