Quantum Entropy Scoring for Fast Robust Mean Estimation and Improved Outlier Detection

Yihe Dong, Samuel B. Hopkins, Jerry Li

Introduction

We study outlier-robust statistics in high dimensions, focusing on the question: can theoretically sound outlier robust algorithms have practical running times for large, high-dimensional data sets? We address two related problems: robust mean estimation, which is primarily theoretical, and an applied counterpart, outlier detection.

Robust mean estimation Our main theoretical contribution is the first nearly-linear time algorithm for robust mean estimation with nearly-optimal error. Here the goal is to estimate the mean μ∈Rd\mu\in\R^{d} of a dd-dimensional distribution DD given ϵ\epsilon-corrupted samples X1,…,XnX_{1},\ldots,X_{n} – that is, i.i.d. samples, an unknown ϵ\epsilon-fraction of which have been maliciously corrupted. Under (for instance) the assumption that the covariance of DD is bounded by \Id\Id, it has been long known to be possible in exponential time to estimate μ\mu by μ^\hat{\mu} having ∥μ−μ^∥2≤O(ϵ)\|\mu-\hat{\mu}\|_{2}\leq O(\sqrt{\epsilon}). In particular, this rate of error is independent of dd.

Polynomial-time algorithms provably achieving such dd-independent error became known only recently, starting with the works . Until our work, the running time of algorithms with provably dd-independent error remained suboptimal by polynomial factors in dd or ϵ\epsilon: the fastest running time achieved before this work was O~(min⁡(nd2,nd/ϵ6))\widetilde{O}(\min(nd^{2},nd/\epsilon^{6})) . (Here O~(⋅)\widetilde{O}(\cdot) notation hides logarithmic factors in nn and dd). While these running times represent a dramatic improvement over previous exponential-time algorithms, there are still many interesting regimes where the additional runtime overheads these algorithms incur render them impractically slow. We give the first algorithm for robust mean estimation with running time O~(nd)\widetilde{O}(nd) which achieves error ∥μ−μ^∥2≤O(ϵ)\|\mu-\hat{\mu}\|_{2}\leq O(\sqrt{\epsilon}). Note that this running time is nearly-linear in the input size ndnd. Similar to prior works, our algorithm has information-theoretically optimal sample complexity and nearly-optimal error rates in both the bounded-covariance and sub-Gaussian regimes.

We compare our method to baselines based on PCA and Euclidean distances, as well as more sophisticated algorithms from existing literature based on nearest-neighbor distances. Our algorithm has nearly-linear running time in theory, and simple implementations in practice incur minimal overhead beyond standard spectral methods, allowing us to run on 10241024-dimensional data with no special optimizations and 81928192-dimensional data with a fast approximate implementation. It can therefore be used in practice to complement existing approaches to outlier detection in exploratory data analysis.

For us, an outlier is an element of a data set which was generated according to a different process than the majority of the data. For instance, we may imagine that our samples X1,…,XnX_{1},\ldots,X_{n} were sampled i.i.d. from a distribution (1−ϵ)D+ϵN(1-\epsilon)D+\epsilon N over Rd\R^{d}, where DD is the distribution of inliers, NN is the distribution of outliers, and ϵ>0\epsilon>0 is a small number – that is, we imagine that a constant fraction of our data may be outliers.

For this discussion, we also informally imagine that NN is sufficiently distinct from DD that the set of outliers could be approximately identified by brute-force search over subsets of (1−ϵ)n(1-\epsilon)n samples, if given unlimited computational resources. Otherwise, outlier detection is not a meaningful problem, and robust mean estimation is easy (because the empirical mean will be a good estimator). Under these circumstances, what makes identifying outliers and estimating the mean in their presence difficult? Chiefly:

Outliers may not be identifiable in isolation. On its own, a typical outlier Xi∼NX_{i}\sim N may look much like a typical inlier Xj∼DX_{j}\sim D. For instance, it could be ∥Xi∥2≈∥Xj∥2\|X_{i}\|_{2}\approx\|X_{j}\|_{2}, and Xi,XjX_{i},X_{j} may have similar distance to the nearest few neighboring samples, especially in high dimensions where samples are far apart.

Outliers still introduce bias, collectively Even if individual outliers look innocuous, the collective effect a modified ϵ\epsilon-fraction of samples XiX_{i} can still substantially change the empirical distribution of X1,…,XnX_{1},\ldots,X_{n}. As a result, even simple statistical tasks like estimating the mean or covariance of DD require sophisticated estimators: naively pruning individual outliers and then employing standard empirical estimators typically leads to far-suboptimal error rates. For example, an ϵ\epsilon-fraction of X1,…,XnX_{1},\ldots,X_{n} which are all slightly biased in a single direction may shift the empirical mean of X1,…,XnX_{1},\ldots,X_{n}, but this bias will be difficult to detect by looking at small numbers of samples at once. This also demonstrates that successful outlier detection can require global geometric information about a high-dimensional dataset, such as whether or not a direction exists in which many (say, ϵn\epsilon n) samples are unusually biased.

Outliers may be inhomogeneous. Outliers need not exhibit unusual bias in only one direction, or all have the same norm, or lie in a single cluster. Rather, if a dataset exhibits several forms of corruption, there may be as many different-looking kinds of outliers. In the theoretical robust mean estimation setting, the adversary producing ϵ\epsilon-corrupted samples may corrupt ϵn/10\epsilon n/10 samples by biasing them in some direction, another ϵn/10\epsilon n/10 samples by unusually enlarging their norms, and so forth.

Since robust mean estimation involves a malicious adversary, all of the above phenomena must be addressed by our robust mean estimation algorithm. In the empirical section of this paper, we focus on designing an outlier detection method suited to situations where at least one of them occurs – in other cases, existing methods (such as those based on Euclidean norms or local neighborhoods of individual samples ) may be more appropriate.

2 QUE: Quantum Entropy Scoring

Recent innovations in robust mean estimation rely on the following crucial observation about ϵ\epsilon-corrupted samples X1,…,XnX_{1},\ldots,X_{n} from a distribution DD with covariance Σ⪯\Id\Sigma\preceq\Id. Namely: any subset S⊆{X1,…,Xn}S\subseteq\{X_{1},\ldots,X_{n}\} of samples which shift the empirical mean by distance more than ϵ\sqrt{\epsilon} in some direction vv also introduce an eigenvalue of magnitude greater than 11 to the empirical covariance.

In robust mean estimation, this leads to (amongst others) the filter algorithm of , one of the first to achieve dimension-independent error rates. Roughly speaking, the algorithm iterates the following until the empirical covariance Σ‾\overline{\Sigma} has small spectral norm: (1) compute the top eigenvector vv of the empirical covariance of Σ‾\overline{\Sigma}, then (2) throw out samples XiX_{i} whose projections ∣⟨Xi−μ‾,v⟩∣≫1|\langle X_{i}-\overline{\mu},v\rangle|\gg 1 is unusually large, where μ‾\overline{\mu} is the empirical mean of the corrupted dataset. For outlier detection this suggests a natural scoring rule – let the outlier score τi\tau_{i} of sample XiX_{i} be proportional to ∣⟨Xi−μ‾,v⟩∣|\langle X_{i}-\overline{\mu},v\rangle|.

The main drawback of these algorithms is that they do not adequately account for inhomogeneity of outliers. For the filter, this leads to a worst-case running time of O~(nd2)\widetilde{O}(nd^{2}), because the filter operation (which can be implemented in O~(nd)\widetilde{O}(nd) time) may have to be repeated as many as dd times if the adversary introduces outliers lying in dd orthogonal directions. The rule τi=∣⟨Xi−μ‾,v⟩∣\tau_{i}=|\langle X_{i}-\overline{\mu},v\rangle| may miss outliers causing a large eigenvalue of Σ‾\overline{\Sigma}, but in a direction orthogonal to the top eigenvector vv.

Our first observation is that any eigenvalue/eigenvector λ,v\lambda,v – not just the top ones – of the empirical covariance with λ≫1\lambda\gg 1 must be due to outliers. We therefore consider the intermediate goal of finding a distribution over directions v∈Rdv\in\R^{d} containing information about as many outlier directions as possible. We formalize this as the following entropy-regularized convex program over d×dd\times d positive semidefinite matrices:

QUE scores are also appealing from a computational perspective: we show that a list of approximate QUE scores τi′=(1±0.01)τi\tau_{i}^{\prime}=(1\pm 0.01)\tau_{i} can be computed from X1,…,XnX_{1},\ldots,X_{n} in nearly-linear time, by appropriate use of Johnson-Lindenstrauss sketching and efficient computation of the matrix exponential by series expansion. This is crucial to both the nearly-linear running time of our algorithm for robust mean estimation and to the scalability of our outlier detection method.

In Section 1.4 we describe refinements of QUE scoring which fit it into the matrix multiplicative weights framework , leading to our nearly-linear time algorithms for robust mean estimation. We give two very similar algorithms, one for when the distribution of inliers is only assumed to have bounded covariance, and one when the inliers are assumed to be subgaussian. The resulting algorithms are conceptually similar to the following modification of the filter mentioned above: until ∥Σ‾∥2≤O(1)\|\overline{\Sigma}\|_{2}\leq O(1), compute QUE scores τi\tau_{i}, throw out data points XiX_{i} with τi≫1\tau_{i}\gg 1, and repeat. (To obtain provable guarantees, our final algorithms are somewhat more complex: in some iterations we use QUE scores based on certain reweightings of the data learned in previous iterations.)

In Section 1.5 we describe experiments validating the QUE scoring rule on both synthetic and real data sets. We show that it performs especially well by comparison to local-neighborhood methods and to scoring based on only the top eigenvector in data sets where the inliers are close to isotropic (or can be made so by applying data whitening procedures) and in which there are heterogeneous outliers.

3 Related work

Robust mean estimation: The study of robust statistics and in particular robust mean estimation began with major works by Anscombe, Huber, Tukey and others in the 1960s . The literature on polynomial-time algorithms for robust statistics has exploded in recent years, following works by Diakonikolas et al and Lai, Rao and Vempala giving the first polynomial-time algorithms for robust mean estimation with dimension-independent (or nearly dimension-indepedent) error . A full survey is beyond our scope here – see e.g. the recent theses for a thorough account. Particularly relevant to our work is the recent work of Cheng, Diakonikolas, and Ge who design an algorithm for robust mean estimatin with running time O~(nd/ϵ6)\widetilde{O}(nd/\epsilon^{6}) – the first to achieve nearly linear time for constant ϵ\epsilon – by appeal to nearly linear time solvers for packing and covering semidefinite programs . Our algorithms carry two advantages over this prior work: first, our algorithm runs in nearly linear time for any choice of ϵ=ϵ(n,d)\epsilon=\epsilon(n,d), and second, because we avoid the 1/ϵ61/\epsilon^{6} scaling and appeal to semidefinite programming, our theoretical ideas lead to a practical method for outlier detection. The techniques of Diakonikolas et al. were later extended to robust covariance estimation ; it remains an interesting direction to extend our techniques to covariance estimation.

Concurrent work: After this manuscript was initially submitted, we became aware of the concurrent work , which also obtains a nearly-linear time algorithm for robust mean estimation of distributions with bounded covariance. The algorithm of also obtains subgaussian confidence intervals (see e.g. ), which the algorithm in this work does not. By contrast, the algorithms in our work also obtain improved rates of error with respect to ϵ\epsilon when the underlying distribution is sub-Gaussian, and our method is sufficiently practical that we are able to implement parts of it to run our experiments on outlier detection. (The method of relies on nearly-linear time solvers for packing/covering semidefinite programs, which are not yet practical.) Finally, implicit in the work is a reduction from arbitrary ϵ\epsilon to the case ϵ=1/100\epsilon=1/100; we describe this reduction and some consequences in Appendix B.1.

Outlier detection Detection of outliers goes back nearly to the beginning of statistics itself . Even restricting to the high dimensional case it has a literature too broad to survey here. Much recent work has focused on so-called local outlier factor-based methods, which assign outlier scores based on the local density of other samples near each XiX_{i} – see e.g. and further references in . We find that QUE scoring compares favorably to such local methods in high-dimensional datasets like we describe in Section 1.1 – see Sections 1.5 and 7 for details.

4 Robust mean estimation: results and algorithm overview

We turn to our algorithm for robust mean estimation, deferring details to Sections 2—4.

Let DD be a distribution on Rd\R^{d}. We say that X1,…,XnX_{1},\ldots,X_{n} are an ϵ\epsilon-corrupted set of samples from DD if they are first drawn i.i.d. from DD, then modified by an adversary who may adaptively inspect all the samples, remove ϵn\epsilon n of them, and replace them with arbitrary vectors in Rd\R^{d}.

Note that ϵ\epsilon-corruption is a stronger outlier model than the (1−ϵ)D+ϵN(1-\epsilon)D+\epsilon N mixture model we described in Section 1; our algorithms also work in this milder mixture model. Our main theoretical result is:

For every n,d∈Nn,d\in\N and ϵ>0\epsilon>0 there are algorithms QUEScoreFilter ,s.g.-QUEScoreFilter with running time O~(nd)\widetilde{O}(nd), such that for every distribution DD on Rd\R^{d} with mean μ\mu and covariance Σ\Sigma, given nn ϵ\epsilon-corrupted samples from DD, QUEScoreFilter produces μ^\hat{\mu} such that ∥μ^−μ∥2≤O(ϵ)+O~(d/n)\|\hat{\mu}-\mu\|_{2}\leq O(\sqrt{\epsilon})+\widetilde{O}(\sqrt{d/n}) if Σ⪯\Id\Sigma\preceq\Id, and s.g.-QUEScoreFilter produces μ^\hat{\mu} such that ∥μ^−μ∥2≤O(ϵlog⁡(1/ϵ)+d/n)\|\hat{\mu}-\mu\|_{2}\leq O(\epsilon\sqrt{\log(1/\epsilon)}+\sqrt{d/n}) if DD is sub-Gaussian with Σ=\Id\Sigma=\Id, all with probability at least 0.990.99.

For the bounded covariance case, the O(ϵ)O(\sqrt{\epsilon}) term information-theoretically optimal up to constant factors. The other term, O~(d/n)\widetilde{O}(\sqrt{d/n}), is information-theoretically optimal up to the logarithmic factors in the O~(⋅)\widetilde{O}(\cdot) even without corruptions. For the sub-Gaussian case, the O(εlog⁡1/ϵ)O(\varepsilon\sqrt{\log 1/\epsilon}) term is believed to be necessary for computationally efficient algorithms (see e.g the statistical-query lower bound ), although that term can be made O(ϵ)O(\epsilon) by using computationally-intractable estimators such as Tukey median, and the latter is information-theoretically optimal . The d/n\sqrt{d/n} term is information-theoretically optimal even without corruptions.

In this section we discuss our algorithm for the bounded-covariance case Σ⪯\Id\Sigma\preceq\Id in the setting that the adversary may not remove samples, leaving technical details and the modifications necessary to handle removed samples and sub-Gaussian DD to Section 4.

Let S={X1,…,Xn}⊆RdS=\{X_{1},\ldots,X_{n}\}\subseteq\R^{d} be a dataset with the property that SS partitions into S=Sg∪SbS=S_{g}\cup S_{b} with ∣Sb∣≤ϵn|S_{b}|\leq\epsilon n and \Ei∼Sg(Xi−μg)(Xi−μg)⊤⪯\Id\E_{i\sim S_{g}}(X_{i}-\mu_{g})(X_{i}-\mu_{g})^{\top}\preceq\Id, where μg=\Ei∼SgXi\mu_{g}=\E_{i\sim S_{g}}X_{i}. Given SS, the goal is to find a vector μ^\hat{\mu} with ∥μg−μ^∥2≤O(ϵ)\|\mu_{g}-\hat{\mu}\|_{2}\leq O(\sqrt{\epsilon}).

Like prior algorithms for robust mean estimation, ours maintains a weight vector w1,…,wn≥0w_{1},\ldots,w_{n}\geq 0 with ∑wi≤1\sum w_{i}\leq 1, initialized to wi=1/nw_{i}=1/n. The algorithm iteratively decreases the weight of points suspected to be outliers that are causing ∥μ(w)−μg∥2\|\mu(w)-\mu_{g}\|_{2} to be large. Some prior algorithms, e.g. the filter of instead iteratively throw out points suspected to be outliers. However, since those algorithms are (necessarily) randomized, they can also be viewed as weighting points, where the weight of XiX_{i} is the probability it has not been thrown out. The algorithm we present here can also be implemented by throwing out points in a randomized fashion – we discuss further in the appendix. A key insight of recent work on robust mean estimation is that it suffices to find weights ww which place almost as much mass on SgS_{g} as does the uniform weighting and whose empirical covariance is small. This is formalized in the following lemma. For a weight vector ww, let ∣w∣=∑wi|w|=\sum w_{i}, μ(w)=1∣w∣∑wiXi\mu(w)=\tfrac{1}{|w|}\sum w_{i}X_{i}, and M(w)=1∣w∣∑wi(Xi−μ(w))(Xi−μ(w))⊤M(w)=\tfrac{1}{|w|}\sum w_{i}(X_{i}-\mu(w))(X_{i}-\mu(w))^{\top}. Let ∥M∥2\|M\|_{2} be the spectral norm of a matrix MM.

Let S={X1,…,Xn}S=\{X_{1},\ldots,X_{n}\} be as in Definition 1.3. Suppose that ww is a weight vector such that ∥M(w)∥2≤O(1)\|M(w)\|_{2}\leq O(1) and ww is mostly good, by which we mean ∣1n1Sg−wg∣≤∣1n1Sb−wb∣|\tfrac{1}{n}\textbf{1}_{S_{g}}-w_{g}|\leq|\tfrac{1}{n}\textbf{1}_{S_{b}}-w_{b}|, where 1Sg,1Sb\textbf{1}_{S_{g}},\textbf{1}_{S_{b}} are the indicators of Sg,SbS_{g},S_{b} and wg,wbw_{g},w_{b} are ww restricted to Sg,SbS_{g},S_{b} respectively. (Intuitively, ww is mostly good if it results by removing from the uniform weighting 1S/n\textbf{1}_{S}/n more weight from SbS_{b} than from SgS_{g}.) Then ∥μ(w)−μg∥2≤O(ϵ)\|\mu(w)-\mu_{g}\|_{2}\leq O(\sqrt{\epsilon}).

Lemma 1.2 captures the following geometric intuition: if the bad points SbS_{b} receive enough weight in ww to cause ∥μ(w)−μg∥2≫ϵ\|\mu(w)-\mu_{g}\|_{2}\gg\sqrt{\epsilon}, then an O(ϵ)O(\epsilon)-fraction of the mass of ww is on XiX_{i} which are unusually correlated with the vector μ(w)−μg\mu(w)-\mu_{g}, which leads to a large maximum eigenvalue in M(w)M(w). Prior works employ a variety of methods to find a mostly good weight vector ww with ∥M(w)∥2≤O(1)\|M(w)\|_{2}\leq O(1). Perhaps the simplest is the filter of , which iterates: While ∥M(w)∥2≫1\|M(w)\|_{2}\gg 1, compute its top eigenvector vv and naive spectral scores τi=⟨Xi−μ(w),v⟩2\tau_{i}=\langle X_{i}-\mu(w),v\rangle^{2}. Throw out XiX_{i} with large τi\tau_{i} and repeat.

The filter ensures that the weight vector it maintains is mostly good because (in an averaged sense) τi\tau_{i} can be large only for XiX_{i} which are corrupted. This is because the (weighted) sum of all scores ∑wiτi=⟨M(w),vv⊤⟩≫1\sum w_{i}\tau_{i}=\langle M(w),vv^{\top}\rangle\gg 1, while the contribution to this sum from SgS_{g} has ∑i∈Sgwiτi≈⟨1n∑i∈Sg(Xi−μg)(Xi−μg)⊤,vv⊤⟩≤1\sum_{i\in S_{g}}w_{i}\tau_{i}\approx\langle\tfrac{1}{n}\sum_{i\in S_{g}}(X_{i}-\mu_{g})(X_{i}-\mu_{g})^{\top},vv^{\top}\rangle\leq 1. (Here we ignore some details about centering XiX_{i} at μg\mu_{g} rather than μ(w)\mu(w).) Thus, the τi\tau_{i} from SbS_{b} must make up almost all of ∑wiτi\sum w_{i}\tau_{i}. Simple approaches to removing or downweighting XiX_{i} with large τi\tau_{i} then remove strictly more weight from SbS_{b} than from SgS_{g}.

However, filtering based on naive spectral scores alone faces a barrier to achieving nearly-linear running-time. If the corruptions SbS_{b} are split among many orthogonal directions, the naive spectral filter will have to find those directions one at a time. Thus, it may require Ω(d)\Omega(d) iterations (leading to Ω(nd2)\Omega(nd^{2}) running time) to arrive at ww with ∥M(w)∥2≤O(1)\|M(w)\|_{2}\leq O(1).

Our main idea is that by replacing naive spectral scores with slightly modified QUE scores, each iteration of the filter can take into account projections of each sample onto many large eigenvectors of M(w)M(w). We show that our modified QUE scores τi\tau_{i} maintain the property that ∑i∈Sbwiτi≫∑i∈Sgwiτi\sum_{i\in S_{b}}w_{i}\tau_{i}\gg\sum_{i\in S_{g}}w_{i}\tau_{i}, and so downweighting according to τi\tau_{i} removes more mass from SbS_{b} than SgS_{g}. However, filtering with QUE scores makes faster progress than with naive spectral scores: roughly speaking, we show that only O(log⁡d)2O(\log d)^{2} rounds of filtering according to QUE scores are required to find a mostly-good weight vector ww with ∥M(w)∥2≤O(1)\|M(w)\|_{2}\leq O(1).

The core of our algorithm is a subroutine, DecreaseSpectralNorm, to take a mostly good weight vector ww with ∥M(w)∥2≫1\|M(w)\|_{2}\gg 1 and in O(log⁡d)O(\log d) rounds of QUE filtering produce another mostly good w′w^{\prime} with ∥M(w′)∥2≤34∥M(w)∥2\|M(w^{\prime})\|_{2}\leq\tfrac{3}{4}\|M(w)\|_{2}. Repeating this subroutine O(log⁡d)O(\log d) times and then outputting the resulting μ(w)\mu(w) yields our main algorithm. An outline of this subroutine is presented as Algorithm 1. We first establish a rigorous sense in which downweighting according to outlier scores τi\tau_{i} makes progress: it decreases the weighted average of the scores while removing more weight from bad points than good.

There is a downweighting algorithm which takes a density matrix UU and a mostly good weight vector ww and produces a mostly good weight vector w′w^{\prime} by downweighting points with large score τi=⟨Xi−μ(w),U(Xi−μ(w)⟩\tau_{i}=\langle X_{i}-\mu(w),U(X_{i}-\mu(w)\rangle such that ∑wi′τi≤13∑wiτi\sum w_{i}^{\prime}\tau_{i}\leq\tfrac{1}{3}\sum w_{i}\tau_{i} so long as ∑wiτi≫1\sum w_{i}\tau_{i}\gg 1. Furthermore, M(w′)⪯M(w)M(w^{\prime})\preceq M(w).

Let us give a geometric interpretation to Lemma 1.3: it establishes that if ∑wiτi=⟨U,M(w)⟩≫1\sum w_{i}\tau_{i}=\langle U,M(w)\rangle\gg 1 then the quadratic form of M(w′)M(w^{\prime}) decreases in the directions defined by UU, since

This guarantee becomes more meaningful as the entropy S(U)S(U) increases, because it suggests the quadratic form of M(w)M(w) has decreased in more directions. To make this formal, we appeal to the matrix multiplicative weights framework. DecreaseSpectralNorm applies downweighting iteratively using a sequence of entropy-maximizing density matrices U1,…,UTU_{1},\ldots,U_{T} chosen according to the matrix multiplicactive weights update rule, leading to a series of mostly good weight vectors w1,…,wTw_{1},\ldots,w_{T} such that ∥M(wT)∥2≤34∥M(w0)∥2\|M(w_{T})\|_{2}\leq\tfrac{3}{4}\|M(w_{0})\|_{2}. We choose

where w0=ww_{0}=w is the input weight vector, U0=\IdU_{0}=\Id, and wtw_{t} results from applying the downweighting of Lemma 1.3 to wt−1w_{t-1} using UtU_{t} (if ⟨M(wt−1),Ut⟩≫1\langle M(w_{t-1}),U_{t}\rangle\gg 1). The following lemma is a special case of the standard (local norm) regret bound for matrix multiplicative weights.

For any w0,…,wTw_{0},\ldots,w_{T}, if α≤1/∥M(wt)∥2\alpha\leq 1/\|M(w_{t})\|_{2} for all t≤Tt\leq T, then

Now we sketch the analysis of DecreaseSpectralNorm.

If w=w0w=w_{0} is mostly good, with ∥M(w0)∥2≥100\|M(w_{0})\|_{2}\geq 100, then DecreaseSpectralNorm produces mostly good wTw_{T} with ∥M(wT)∥2≤34∥M(w)∥2\|M(w_{T})\|_{2}\leq\tfrac{3}{4}\|M(w)\|_{2}.

Since M(wt)⪯M(wt+1)M(w_{t})\preceq M(w_{t+1}) by Lemma 1.3, we have ∥M(wt)∥2≤∥M(w0)∥2\|M(w_{t})\|_{2}\leq\|M(w_{0})\|_{2} for all tt, and hence α=1/∥M(w0)∥2≤1/∥M(wt)∥2\alpha=1/\|M(w_{0})\|_{2}\leq 1/\|M(w_{t})\|_{2} for all tt, so w0,…,wTw_{0},\ldots,w_{T} and U0,…,UT−1U_{0},\ldots,U_{T-1} satisfy the hypotheses of Lemma 1.4. By our choice of α\alpha and M(wT)⪯M(wt)M(w_{T})\preceq M(w_{t}) for all tt, (4) implies

If ⟨Ut,M(wt−1)⟩≥∥M(w0)∥2/3≫1\langle U_{t},M(w_{t-1})\rangle\geq\|M(w_{0})\|_{2}/3\gg 1, then DecreaseSpectralNorm performs downweighting, and by Lemma 1.3 and (2) (which we establish rigorously in supplemental material), ⟨M(wt),Ut⟩≤13⟨M(wt−1),Ut⟩≤13∥M(w0)∥\langle M(w_{t}),U_{t}\rangle\leq\tfrac{1}{3}\langle M(w_{t-1}),U_{t}\rangle\leq\tfrac{1}{3}\|M(w_{0})\|. Otherwise, by hypothesis ⟨M(wt),Ut⟩=⟨M(wt−1),Ut⟩≤∥M(w0)∥2/3\langle M(w_{t}),U_{t}\rangle=\langle M(w_{t-1}),U_{t}\rangle\leq\|M(w_{0})\|_{2}/3. Using this bound and dividing by TT, we obtain ∥M(wT)∥2≤(23+log⁡dT)∥M(w0)∥2\|M(w_{T})\|_{2}\leq(\tfrac{2}{3}+\tfrac{\log d}{T})\|M(w_{0})\|_{2}. Choosing T≥20log⁡dT\geq 20\log d completes the proof sketch. ∎

Running time: Our overall algorithm only requires log⁡(nd)O(1)\log(nd)^{O(1)} iterations of DecreaseSpectralNorm, and the latter only requires O(log⁡(d))O(\log(d)) iterations of downweighting, so we just have to implement downweighting in nearly-linear time. We show in supplemental material that this can be done by avoiding representing any of the matrices UtU_{t} explicitly in memory: instead, we maintain only low-rank sketches of them. This leads to some approximation error in computing the QUE scores, but we show that approximations to the QUE scores suffice for all arguments above.

For remaining technical details and full proofs, see Sections 5-9 of supplemental materials.

5 Outlier detection: algorithm and experimental results

In this section, we empirically evaluate outlier detection using QUE scoring. We must work with data containing well-defined and known inliers and outliers so that we can compare our results to ground-truth. We generate such data sets in three distinct ways, leading to three main experiments. (In supplemental material we also study some outlier-detection data sets appearing in prior work .)

Synthetic: We create synthetic data sets in 128128 dimensions and 103−10410^{3}-10^{4} samples with an ϵ\epsilon-fraction of inhomogeneous outliers in kk directions by sampling from a mixture of k+1k+1 Gaussians (1−ϵ)N(0,\Id)+∑i=1kϵi[12N(Ck/ϵ⋅ei,σ2\Id)+12N(−Ck/ϵ⋅ei,σ2\Id)](1-\epsilon)\mathcal{N}(0,\Id)+\sum_{i=1}^{k}\epsilon_{i}[\tfrac{1}{2}\mathcal{N}(C\sqrt{k/\epsilon}\cdot e_{i},\sigma^{2}\Id)+\tfrac{1}{2}\mathcal{N}(-C\sqrt{k/\epsilon}\cdot e_{i},\sigma^{2}\Id)], where e1,…,eke_{1},\ldots,e_{k} are standard basis vectors, with C≈1C\approx 1 and σ≪1\sigma\ll 1. The outliers are the samples from N(±Ck/ϵei,σ2\Id)\mathcal{N}(\pm C\sqrt{k/\epsilon}e_{i},\sigma^{2}\Id). By varying ϵ,k\epsilon,k and the distribution ϵ1,…,ϵk\epsilon_{1},\ldots,\epsilon_{k} of outlier weights, we demostrate in this simplified model how max-entropy outlier scoring improves on baseline algorithms in the presence of inhomogeneous outliers. We choose the scaling k/ϵ⋅ei\sqrt{k/\epsilon}\cdot e_{i} because then standard calculations predict that if ϵi≈ϵ/k\epsilon_{i}\approx\epsilon/k the outliers from N(±Ck/ϵei,σ2\Id)\mathcal{N}(\pm C\sqrt{k/\epsilon}e_{i},\sigma^{2}\Id) will contribute an eigenvalue greater than 11 to the overall empirical covariance.

Mixed – word embeddings: We create a data set consisting of word embeddings drawn from several sources. Inliers are the 100100-dimensional GloVe embeddings () of the words in a random ≈103\approx 10^{3} word long section of a novel (we use Sherlock Holmes) and outliers are embeddings of the first paragraphs of kk featured Wikipedia articles from May 2019 .

Perturbed – images: We create a data set consisting of CIFAR10 images some of which have artificially-introduced dead pixels. Inliers are ≈4500\approx 4500 random CIFAR images X∈{1,…,256}1024X\in\{1,\ldots,256\}^{1024} (restricted to the red color channel). Outliers are ≈500\approx 500 random CIFAR images, partitioned into groups S1,…,SkS_{1},\ldots,S_{k}, such that for each group ii a random coordinate pi∈{1,…,1024}p_{i}\in\{1,\ldots,1024\} and a random value ci∈{1,…,256}c_{i}\in\{1,\ldots,256\} is chosen and for each X∈SiX\in S_{i} we set Xpi=ciX_{p_{i}}=c_{i}.

Metric: All the methods we evaluate produce a vector of scores τ1,…,τn∈R\tau_{1},\ldots,\tau_{n}\in\R. We use the standard ROCAUC metric to compare these scores to a ground-truth partition S=Sg∪SbS=S_{g}\cup S_{b} into inlier and outlier sets. ROCAUC(τ1,…,τn,Sb,Sg)=Pr⁡i∼Sb,j∼Sg(τi≥τj)\text{ROCAUC}(\tau_{1},\ldots,\tau_{n},S_{b},S_{g})=\Pr_{i\sim S_{b},j\sim S_{g}}(\tau_{i}\geq\tau_{j}) is simply the probability that a randomly chosen outlier is scored higher than a random inlier.

Whitening: Scoring methods based on the projection of data points XiX_{i} onto large eigenvectors of the empirical covariance work best when those eigenvectors correspond to directions in which many outliers lie. In particular, if Σg\Sigma_{g}, the covariance of SgS_{g}, itself has large eigenvalues then such spectral methods perform poorly. We assume access to a whitening transformation W∈Rd×dW\in\R^{d\times d}, which captures a small amount of prior knowledge about the distribution of inliers SgS_{g}. For best performance WW should approximate W∗=(Σg)−1/2W^{*}=(\Sigma_{g})^{-1/2} since W∗XiW^{*}X_{i} form an isotropic set of vectors. Of course, to compute W∗W^{*} exactly would require knowing which points are inliers, but we find that relatively naive approximations suffice. In particular, if a clean dataset Y1,…,YmY_{1},\ldots,Y_{m} whose distribution is similar to the distribution of inliers is available, its empirical covariance can be used to find a good whitening transformation WW. In our synthetic data we use W=\IdW=\Id. In our word embeddings experiment, we obtain WW using the empirical covariance of the embedding of another random section of Sherlock Holmes. In our CIFAR-10 experiment, we obtain WW from the empirical covariance of a fresh sample of ≈5000\approx 5000 randomly chosen images from CIFAR-10.

High-dimensional scaling: Implementing Algorithm 2 by explicitly forming the matrix Σ‾\overline{\Sigma} and performing a singular value decomposition (SVD) to compute exp⁡(αΣ‾)\exp(\alpha\overline{\Sigma}) is feasible on relatively low-dimensional data (d≈100d\approx 100). See Section 7 for discussion and results of a nearly-linear time implementation.

Robust mean estimation: results and preliminaries

for all kk even. We say a distribution DD over Rd\R^{d} and mean μ\mu is sub-gaussian with variance proxy Σ⪯I\Sigma\preceq I, if for all unit vectors vv, the distribution of ⟨v,X−μ⟩\left\langle v,X-\mu\right\rangle is sub-Gaussian with variance proxy v⊤Σvv^{\top}\Sigma v. Intuitively, a sub-Gaussian distribution is simply any distribution which concentrates as well as a Gaussian.

With this terminology in place, we are now ready to state our main results on robust mean estimation. Our first result is for robust mean estimation under the assumption of bounded covariance:

Let DD be a distribution on Rd\R^{d} with mean μ\mu and covariance Σ⪯I\Sigma\preceq I. Let ε>0\varepsilon>0 be sufficiently small, and let δ>0\delta>0. Let SS be an ε\varepsilon-corrupted set of samples from DD of size nn. There is an algorithm \textscQUEScoreFilter(S,δ,ϵ)\textsc{QUEScoreFilter}(S,\delta,\epsilon) which takes SS and δ\delta, and outputs μ^\widehat{\mu} so that with probability 1−δ−exp⁡(−εn)1-\delta-\exp(-\varepsilon n), we have

Moreover, the algorithm runs in time O~(ndlog⁡1/δ)\widetilde{O}(nd\log 1/\delta).

We make two observations about this problem. First, it is well-understood (see e.g. ) that Ω(ε)\Omega(\sqrt{\varepsilon}) error is unavoidable for this problem, no matter how many samples are given. Second, observe that the rate O(d/n)O(\sqrt{d/n}) is necessary for this problem even without corruptions. Thus, up to log factors, and the dependence on δ\delta, this guarantee is information-theoretically optimal. We note also that the algorithm does not need to know ϵ\epsilon exactly; any upper bound will suffice (with commensurate weakening in the error rate).

We also prove a strong statement for the case of robust mean estimation for sub-gaussian distributions:

Let DD be an isotropic sub-gaussian distribution with variance proxy II and mean μ\mu. Let ε>0\varepsilon>0 be sufficiently small, and let δ>0\delta>0. Let SS be an ε\varepsilon-corrupted set of samples from DD of size nn. There is an algorithm \textscs.g.−QUEScoreFilter(S,δ,ε)\textsc{s.g.-QUEScoreFilter}(S,\delta,\varepsilon) which takes S,δS,\delta, and ε\varepsilon, and outputs μ^\widehat{\mu} so that with probability 1−δ1-\delta, we have

Moreover, the algorithm runs in time O~(ndlog⁡1/δ)\widetilde{O}(nd\log 1/\delta).

It is suspected, based on statistical-query lower bounds, that Ω(εlog⁡1/ε)\Omega(\varepsilon\sqrt{\log 1/\varepsilon}) error is incurred by any computationally-efficient algorithm in this setting, although Θ(ϵ)\Theta(\epsilon) is the minimax optimal dependence of the error rate on ϵ\epsilon . Moreover, Ω((d+log⁡1/δ)/n)\Omega\left(\sqrt{(d+\log 1/\delta)/n}\right) is the minimax rate for mean estimation for Gaussians without noise. Thus, the error guarantees of this algorithm are minimax optimal up to constants and the factor log⁡(1/ϵ)\sqrt{\log(1/\epsilon)}.

This algorithm assumes that the distribution is isotropic. There is evidence that such an assumption is necessary to get error beyond ε\sqrt{\varepsilon} using computationally efficient (i.e. poly-time) algorithms . In our theorem statement above we also assume that the variance proxy is at most II. This is done for simplicity: it is easily verifiable that our algorithm works (with an appropriate scaling in front of the error guarantee) if the variance proxy is PSD upper bounded by σ2I\sigma^{2}I for any σ2\sigma^{2}.

Before we describe our techniques, we require a few additional algorithmic tools, which we describe below.

2 Soft selection of subsets of points

In our presentation of our filtering algorithm for robust mean estimation, it will be convenient for us to work with a “soft” version of the filter. Instead of wholly removing points that we deem suspicious, we will maintain a set of weights for each point, and downweight those that we find suspicious. In this section, we establish notation for dealing with such operations. However, we briefly remark that, as we will explain later in Appendix A.3, the same results (up to log factors) can be established using “hard” filtering more akin to the algorithms presented in prior work, e.g. .

Throughout this paper, we will let Δn\Delta_{n} denote the simplex in nn dimensions, and we let

Typically when the set SS is understood, we will omit the dependence on SS in the notation. For any set T⊆ST\subseteq S, we let μ(T)=μ(w)\mu(T)=\mu(w) where w∈Γnw\in{\Gamma}_{n} is the vector wi=1/nw_{i}=1/n for i∈Ti\in T and wi=0w_{i}=0 otherwise, and similarly we let M(T)=M(w)M(T)=M(w).

3 Naive pruning

One primitive we will require will be the ability to removes points which are “obviously” outliers. It is well-known that there exist randomized nearly-linear time algorithms for achieving this. For completeness we prove this lemma in Appendix A.

There is an algorithm NaivePrune with the following guarantees. Let ε>1/2\varepsilon>1/2, and let δ>0\delta>0. Let S⊂RdS\subset\R^{d} be a set of nn points so that there exists a ball BB of radius rr and a subset S′⊆SS^{\prime}\subseteq S so that ∣S′∣≥(1−ε)n|S^{\prime}|\geq(1-\varepsilon)n, and S′⊂BS^{\prime}\subset B. Then \textscNaivePrune(S,r,δ)\textsc{NaivePrune}(S,r,\delta) runs in time O(ndlog⁡1/δ)O(nd\log 1/\delta) and with probability 1−δ1-\delta outputs a set of points T⊆ST\subseteq S so that S′⊆TS^{\prime}\subseteq T, and TT is contained in a ball of radius 4r4r.

In the case where the output of NaivePrune satisfies the conditions of the lemma, we say that NaivePrune succeeds.

4 The one-dimensional filter

An important algorithmic primitive for us will be an univariate soft outlier removal step. The sub-problem considered here is as follows: we are given a set of nonegative scores τ1,…,τm\tau_{1},\ldots,\tau_{m}, with the guarantee that there is a small subset S⊆[m]S\subseteq[m] so that ∑i∈Sτi>12∑i=1mτi\sum_{i\in S}\tau_{i}>\frac{1}{2}\sum_{i=1}^{m}\tau_{i}, that is, they contribute a majority of the mass of the points. The goal is to then either downweight (or remove) the overall set of scores in such a way so that more mass from SS is removed than from outside of SS, or alternatively, more points are removed from SS than from outside SS. An algorithm for achieving this via downweighting has already been described in , and a randomized algorithm that achieves the same sorts of guarantees with high probability by removing points is implicit in the filtering algorithm of (e.g. in Algorithm 3 in Appendix A of ). In this paper, we will require a slight strengthening of these algorithms. We require that not only do we remove more weight from the bad points than the good points, but we also decrease the overall sum by a constant factor. We observe that while we will present a method for acheving this via downweighting, one can achieve the same guarantee (with high probability) by removing points. In the main text, we choose to present the soft downweighting method for robust mean estimation for simplicity. See Appendix A.3 for details.

Formally, we describe an algorithm 1DFilter and prove the following guarantee for the algorithm. The algorithm and its analysis are fairly straightforward so we defer the formal descriptions and proofs to Appendix A.2.

Let η∈(0,1/2)\eta\in(0,1/2), let b≥2ηb\geq 2\eta, and let w1,…,wmw_{1},\ldots,w_{m} and τ1,…,τm\tau_{1},\ldots,\tau_{m} be non-negative numbers so that ∑i=1mwi≤1\sum_{i=1}^{m}w_{i}\leq 1. Let τmax⁡=max⁡i∈[m]τi\tau_{\max}=\max_{i\in[m]}\tau_{i}. Suppose there exist two disjoint sets Sg,SbS_{g},S_{b} so that Sg∪Sb=[m]S_{g}\cup S_{b}=[m], and moreover,

Then \textsc1DFilter(w,τ,b)\textsc{1DFilter}(w,\tau,b) runs in time O((1+log⁡τmax⁡bσ)m)O\left(\left(1+\log\frac{\tau_{\max}}{b\sigma}\right)m\right) and outputs 0≤w′≤w0\leq w^{\prime}\leq w so that:

more weight is removed from SbS_{b} than SgS_{g}, i.e. ∑i∈Sgwi−wi′≤∑i∈Sbwi−wi′\sum_{i\in S_{g}}w_{i}-w_{i}^{\prime}\leq\sum_{i\in S_{b}}w_{i}-w_{i}^{\prime}, and

the weighted sum of the τ\tau has decreased, i.e. w′w^{\prime} satisfies

In particular, note that if b=Ω(1)b=\Omega(1) and τmax⁡/σ≤mO(1)\tau_{\max}/\sigma\leq m^{O(1)}, then this algorithm runs in nearly linear time.

As mentioned previously, there is also a randomized strategy that avoids downweighting and achieves the same guarantee with high probability (up to logarithmic factors in runtime). Our overall robust mean estimation algorithm (for both settings presented in the paper) can be instantiated using this algorithm rather than 1DFilter. While as far as we know this yields no theoretical improvements for robust mean estimation (indeed, our analysis of it proves bound which are worse by logarithmic factors than our analysis of soft downweighting), it is much closer to the practical outlier detection method used in the experiments in Section 1.5 and also to prior algorithms presented in , and may be of instructive value. For this reason we describe this algorithm in Appendix A.3.

5 Matrix Multiplicative weights

We will use the following form of the MMW update, which is essentially the same as presented in . In each iteration t=0,…,Tt=0,\ldots,T, the player chooses an action Uk∈Δd×dU_{k}\in\Delta_{d\times d}, receives a gain matrix Ft∈Rd×dF_{t}\in\R^{d\times d}, and receives reward ⟨Fk,Uk⟩\langle F_{k},U_{k}\rangle. Then the player sees FkF_{k}. In , they demonstrate that if the player plays according to the entropy regularizer (or equivalently, matrix multiplicative weights), namely,

Here, for any symmetric matrix A=∑i=1dλivivi⊤A=\sum_{i=1}^{d}\lambda_{i}v_{i}v_{i}^{\top}, we let ∣A∣|A| denote ∣A∣=∑i=1d∣λi∣vivi⊤|A|=\sum_{i=1}^{d}|\lambda_{i}|v_{i}v_{i}^{\top}. Equivalently, by rearranging terms, and taking a supremum over UU of (8), we obtain that the update satisfies

An MMW algorithm for robust mean estimation with bounded covariance

In this section we describe the algorithm which achieves Theorem 2.1. We first identify a deterministic condition on the set of inliers under which our algorithm is guaranteed to be correct. It is a very mild condition: at a high level, it simply states that the empirical mean of the samples is converging to the true mean, and the empirical covariance is bounded.

We say a set of points SS is (γ1,γ2)(\gamma_{1},\gamma_{2})-good with respect to a distribution DD with mean μ\mu and covariance Σ⪯\Id\Sigma\preceq\Id if the following two properties hold:

The following is a generalization of Lemma A.18 in , which states that, with high probability, any set of i.i.d. points from a distribution with bounded covariance will contain a large set which is good with respect to that distribution. For completeness we prove this lemma in Appendix B.

Let ε∈[0,1/2)\varepsilon\in[0,1/2), and let nn be a positive integer. Let DD be a distribution with mean μ\mu and covariance Σ⪯\Id\Sigma\preceq\Id, and let X1,…,XnX_{1},\ldots,X_{n} be independent draws from DD. Then, with probability 1−δ−exp⁡(−εn)1-\delta-\exp(-\varepsilon n), there exists a set S⊆{X1,…,Xn}S\subseteq\{X_{1},\ldots,X_{n}\} so that the following two conditions are simultaneously satisfied:

SS is (γ1,γ2)(\gamma_{1},\gamma_{2})-good with respect to DD, where

for some universal constants c,c′>0c,c^{\prime}>0.

In particular, observe that for constant δ\delta and for n=Ω(dlog⁡d/ε)n=\Omega(d\log d/\varepsilon), we have that γ1=O(ε)\gamma_{1}=O(\varepsilon) and γ2=O(1)\gamma_{2}=O(1).

Throughout we will let S=Sg∪Sb∖SrS=S_{g}\cup S_{b}\setminus S_{r}, where SgS_{g} is (γ1,γ2)(\gamma_{1},\gamma_{2})-good with respect to DD, and ∣Sb∣,∣Sr∣≤ε∣S∣|S_{b}|,|S_{r}|\leq\varepsilon|S|. For any w∈Γnw\in{\Gamma}_{n}, we let wg∈Γ∣Sg∣w_{g}\in{\Gamma}_{|S_{g}|} denote the restriction of ww to the indices in SgS_{g}, and similarly define wb∈Γ∣Sb∣w_{b}\in{\Gamma}_{|S_{b}|}.

Our set of weights of interest will be slightly different than those considered in prior papers, but morally captures the same concept, up to issues of reweighting. We will always guarantee that the weights we consider lie within the following set:

Intuitively, weights in the set Sn,ε\mathfrak{S}_{n,\varepsilon} are what happens when we start with the uniform weighting 1n⋅1\tfrac{1}{n}\cdot\mathbf{1} and remove weight from points in the data set, always removing at least as much mass from the bad set as we do from the good set.

2 Geometric lemmata

We first prove the following sequence of structural lemmata. The first, which is implicit in the earlier work, and which is in some sense the fundamental geometric fact which guides our algorithmic design, gives an upper bound on the deviation between the weighted empirical mean of the data set and the true mean of the distribution in terms of the spectral norm of the weighted covariance of the dataset.

Let S,γ1,γ2S,\gamma_{1},\gamma_{2} be as above, and let w∈Sn,εw\in\mathfrak{S}_{n,\varepsilon}. Then

Let ρ=μ(w)−μ\rho=\mu(w)-\mu. We have the following sequence of identities:

We now upper bound each term separately. By Cauchy-Schwarz, we have

We now turn our attention to W2W_{2} and W3W_{3}. Both bounds will follow from the following claim:

Let w′,α∈Γnw^{\prime},\alpha\in{\Gamma}_{n} be so that ∣w′∣≤ε|w^{\prime}|\leq\varepsilon, wi′≤1nw^{\prime}_{i}\leq\frac{1}{n} for all i∈[n]i\in[n], and w′≤αw^{\prime}\leq\alpha. Then, for any v∈Rdv\in\R^{d}, we have

Here (a) follows since wi′≤αiw_{i}^{\prime}\leq\alpha_{i}, and (b) follows from the definition of spectral norm, and the assumption on ∣w′∣|w^{\prime}|. Thus, by taking square roots and combining terms, we have

With this claim, we can now bound W2W_{2} and W3W_{3}. To bound W2W_{2}, let wi′=1n−wiw^{\prime}_{i}=\frac{1}{n}-w_{i} for i∈Sgi\in S_{g} and wi=0w_{i}=0 otherwise, and let αi=1n\alpha_{i}=\frac{1}{n} if i∈Sgi\in S_{g}, and 00 otherwise. Then, applying the claim with v=ρv=\rho yields that

Similarly, to bound W3W_{3}, let wi′=wiw^{\prime}_{i}=w_{i} if i∈Sbi\in S_{b} and wi′=0w^{\prime}_{i}=0 otherwise, and let αi=wi\alpha_{i}=w_{i} for all i∈Si\in S. Again, letting v=ρv=\rho, we get that

as well. Combining these three bounds, and using the fact that ∣w∣≤1|w|\leq 1, yields that

Simplifying this expression then yields the desired bound on ∥ρ∥2\|\rho\|_{2}. ∎

We also require the following linear algebraic fact:

Let w′,w∈Γnw^{\prime},w\in{\Gamma}_{n} so that w′≤ww^{\prime}\leq w. Then ∣w′∣M(w′)⪯∣w∣M(w)|w^{\prime}|M(w^{\prime})\preceq|w|M(w).

We first observe that if w′≤ww^{\prime}\leq w, then

and so M(w′)⪯M(w)M(w^{\prime})\preceq M(w), as claimed. ∎

3 General algorithm description, bounded second moment

In this section we describe the algorithm we would like to run via matrix multiplicative weights, and demonstrate that it will terminate in a small number of iterations, when given good approximations to the entropic scores.

The algorithm, which we call QUEScoreFilter , proceeds in epochs, and takes as input a corrupted dataset SS, and a score oracle O\mathscr{O}. Initially, in epoch s=0s=0, we let w(0)=1n1nw^{\left(0\right)}=\frac{1}{n}\mathbf{1}_{n}. Then, in epoch ss, the algorithm proceeds iteratively as follows. First, approximately compute λ(s)≈0.1∥M(w(s))∥2\lambda^{\left(s\right)}\approx_{0.1}\|M(w^{\left(s\right)})\|_{2}, and if λ(s)≤100γ2\lambda^{\left(s\right)}\leq 100\gamma_{2}, then we terminate and output μ(w(s))\mu(w^{\left(s\right)}).

where Ut(s)U_{t}^{\left(s\right)} is as in Algorithm 3, namely,

for all t,i,st,i,s, where τt,i(s)\tau_{t,i}^{\left(s\right)} is defined in (10) (the choice of 0.10.1 in the approximation here as well as for λt(s)\lambda^{(s)}_{t} is arbitrary; any constant sufficiently small will suffice). In Section 5 we will demonstrate how to implement such an approximate score oracle in (randomized) nearly-linear time by sketching.

4 Correctness of QUEScoreFilter

We first prove correctness. The main lemma is the following per-epoch guarantee:

The following invariants always hold. For all epochs ss, we have:

ws∈Sn,εw^{s}\in\mathfrak{S}_{n,\varepsilon}, and

If ∥M(w(s))∥2>1001.1γ2\|M\left(w^{\left(s\right)}\right)\|_{2}>\frac{100}{1.1}\gamma_{2} and ∥M(w(s))∥2>1001.1γ12\|M\left(w^{\left(s\right)}\right)\|_{2}>\frac{100}{1.1}\gamma_{1}^{2}, then epoch ss finishes after O(log⁡d)O(\log d) iterations, and outputs w(s+1)w^{\left(s+1\right)} so that ∥M(w(s+1))∥2≤23∥M(w(s))∥2\|M\left(w^{\left(s+1\right)}\right)\|_{2}\leq\frac{2}{3}\|M\left(w^{\left(s\right)}\right)\|_{2}.

We first show how the lemma implies the theorem.

We now prove the runtime bound. In every iteration, besides the call the the oracle, the only costly operations are the approximate top eigenvalue computations and running 1DFilter. However, the approximate top eigenvalue computations can be done in time O~(nd)\widetilde{O}(nd) via power method since we only ask for a constant multiplicative approximation, and the bound on ∥Xi∥2\left\lVert X_{i}\right\rVert_{2} implies that 1DFilter runs in O(nlog⁡κ)O(n\log\kappa) time. ∎

We first show that ∑i∈Sgwiτi≤c∑i=1nwiτi\sum_{i\in S_{g}}w_{i}\tau_{i}\leq c\sum_{i=1}^{n}w_{i}\tau_{i} for some universal constant c≤0.11c\leq 0.11. Let w~i=1n{\widetilde{w}}_{i}=\frac{1}{n} if i∈Sgi\in S_{g} and w~i=0{\widetilde{w}}_{i}=0 otherwise. Then, we have

Here (a) follows from M(w′)⪯∑i=1nwi′(Xi−μ(w))(Xi−μ(w))⊤M(w^{\prime})\preceq\sum_{i=1}^{n}w_{i}^{\prime}(X_{i}-\mu(w))(X_{i}-\mu(w))^{\top}. This completes the proof of the claim. ∎

Notice that Claim 3.7 immediately implies that the first invariant w∈Sn,εw\in\mathfrak{S}_{n,\varepsilon} always holds. We now turn to proving the second invariant. Let TT be the number of iterations that the epoch runs for. Observe that for all t=0,…,Tt=0,\ldots,T, we have that M(wt)⪯M(w0)⪯1αIM(w_{t})\preceq M(w_{0})\preceq\frac{1}{\alpha}I, and so we are indeed in the setting of the guarantee in Section 2.5. Thus, by (8), since Ft=M(wt+1)F_{t}=M(w_{t+1}), we obtain the following regret bound:

where the second inequality follows by our choice of α\alpha. We claim that for all t>0t>0, we must have ⟨M(wt),Ut⟩≤0.31∥M(w0)∥2\left\langle M(w_{t}),U_{t}\right\rangle\leq 0.31\|M(w_{0})\|_{2}. There are two cases. If we enter the if statement in Line 18, then

and M(wt+1)=M(wt)M(w_{t+1})=M(w_{t}), so this is clearly satisfied. Otherwise, the desired bound follows by Claim 3.7. Thus overall, by (14) we have that

By Lemma 3.4, we further have that M(wt+1)⪯M(wt)M(w_{t+1})\preceq M(w_{t}) for all t=0,…,T−1t=0,\ldots,T-1, and so this implies that

Simplifying both sides yields that if T=Clog⁡nT=C\log n for some sufficiently large constant CC, then ∥M(wT)∥2≤23∥M(w0)∥2\|M(w_{T})\|_{2}\leq\frac{2}{3}\|M(w_{0})\|_{2}. Thus after O(log⁡d)O(\log d) iterations, we must terminate. ∎

An MMW algorithm for robust mean estimation for sub-gaussian distributions

In this section we give an analog of the result in Section 3 but but in the setting where the distribution DD is subgaussian, and has identity covariance. We again first identify a deterministic condition for the inlers under which our algorithms will succeed. In this case, we need a stricter analog of ε\varepsilon-goodness. Specifically, we will require:

Let DD be a distribution with covariance \Id\Id and mean μ\mu. We say a set of points SS is (ε,γ1,γ2,β1,β2)(\varepsilon,\gamma_{1},\gamma_{2},\beta_{1},\beta_{2})-subgaussian good (or (ε,γ1,γ2,β1,β2)(\varepsilon,\gamma_{1},\gamma_{2},\beta_{1},\beta_{2})-s.g. good for short) with respect to DD if there exist universal constants C1,C2C_{1},C_{2} so that the following inequalities are satisfied:

∥μ(S)−μ∥≤γ1\left\lVert\mu(S)-\mu\right\rVert\leq\gamma_{1} and ∥1∣S∣∑i∈S(Xi−μ(S))(Xi−μ(S))⊤−\Id∥2≤γ2\left\lVert\frac{1}{|S|}\sum_{i\in S}\left(X_{i}-\mu(S)\right)\left(X_{i}-\mu(S)\right)^{\top}-\Id\right\rVert_{2}\leq\gamma_{2}, and

For any subset T⊂ST\subset S so that ∣T∣=2ε∣S∣|T|=2\varepsilon|S|, we have

For conciseness, when the parameters ε,γ1,γ2,β1,β2\varepsilon,\gamma_{1},\gamma_{2},\beta_{1},\beta_{2} are understood, we will omit them and refer to the data set as s.g.-good.

We have the following concentration inequality. The proof is very similar to that of Lemmata 2.1.8 and 2.1.9 in . For completeness we include a proof of this lemma in Appendix C.

Let X1,…,Xn∼DX_{1},\ldots,X_{n}\sim D, where DD is subgaussian with variance proxy 11. Then, for any ε>0\varepsilon>0 sufficiently small, we have that S={X1,…,Xn}S=\{X_{1},\ldots,X_{n}\} is (ε,γ1,γ2)\left(\varepsilon,\gamma_{1},\gamma_{2}\right)-s.g. good with probability 1−δ1-\delta, where

In particular, note that when n=Ω(d+log⁡1/δε2log⁡1/ε)n=\Omega\left(\frac{d+\log 1/\delta}{\varepsilon^{2}\log 1/\varepsilon}\right), then Lemma 4.1 implies that nn i.i.d. samples from an isotropic sub-gaussian distribution is (ε,O(εlog⁡1/ε),O(εlog⁡1/ε),O(log⁡1/ε),O(log⁡1/ε))(\varepsilon,O(\varepsilon\sqrt{\log 1/\varepsilon}),O(\varepsilon\log 1/\varepsilon),O(\sqrt{\log 1/\varepsilon}),O(\log 1/\varepsilon))-s.g. good with probability 1−δ1-\delta. We will also require the following simple consequences of subgaussian goodness.

Let DD be an isotropic distribution. Let SS be (ε,γ1,γ2,β1,β2)(\varepsilon,\gamma_{1},\gamma_{2},\beta_{1},\beta_{2})-s.g. good w.r.t. DD. Then:

for all w′∈Γnw^{\prime}\in{\Gamma}_{n} with w′≤1n1nw^{\prime}\leq\frac{1}{n}\mathbf{1}_{n} and ∣w′∣≤2ε|w^{\prime}|\leq 2\varepsilon, and for all unit vectors v∈Rdv\in\R^{d}, we have

if w∈Γnw\in{\Gamma}_{n} satisfies w≤1n1nw\leq\frac{1}{n}\mathbf{1}_{n} and ∣1n1n−w∣≤2ε\left|\frac{1}{n}\mathbf{1}_{n}-w\right|\leq 2\varepsilon, then

We first prove the first claim. Let w′′∈Γnw^{\prime\prime}\in\Gamma_{n} be anything so that w′≤w′′≤1n1nw^{\prime}\leq w^{\prime\prime}\leq\frac{1}{n}\mathbf{1}_{n} and ∣w′′∣=ε|w^{\prime\prime}|=\varepsilon. Then since all quantities on the LHS of the expression are nonnegative, we have that

Now let A={w′′∈Γn:∣w′′∣=ε}A=\{w^{\prime\prime}\in\Gamma_{n}:|w^{\prime\prime}|=\varepsilon\}. This set is clearly convex, and moreover, by inspection, the vertices of AA are exactly given by 1n1T\frac{1}{n}\mathbf{1}_{T} where ∣T∣=2εn|T|=2\varepsilon n. Thus, by convexity, the maximum of the RHS of (20) over w′′∈Aw^{\prime\prime}\in A is obtained by w′′=1n1Tw^{\prime\prime}=\frac{1}{n}\mathbf{1}_{T} for some TT with ∣T∣=2εn|T|=2\varepsilon n. But then we have

by the s.g.-goodness of SS. This completes the proof of the first bullet point.

We now turn our attention to the second claim. We have that

by the first claim. Further expanding, we have

Putting it all together yields (18). To prove (19), simply observe that

In the first inequality we have used the definition of subgaussian goodness and convexity. ∎

As a result, we also have the following tail bound on mean shifts caused by small subsets of points:

Let DD be an isotropic distribution. Let SS be (ε,γ1,γ2,β1,β2)(\varepsilon,\gamma_{1},\gamma_{2},\beta_{1},\beta_{2})-s.g. good w.r.t. DD. Then:

for all w′∈Γnw^{\prime}\in{\Gamma}_{n} with w′≤1n1nw^{\prime}\leq\frac{1}{n}\mathbf{1}_{n} and ∣w′∣≤2ε|w^{\prime}|\leq 2\varepsilon, we have

if w∈Γnw\in{\Gamma}_{n} satisfies w≤1n1nw\leq\frac{1}{n}\mathbf{1}_{n} and ∣1n1n−w∣≤2ε\left|\frac{1}{n}\mathbf{1}_{n}-w\right|\leq 2\varepsilon, then

We first prove the first claim. Fix any unit vector v∈Rdv\in\R^{d}. Then we have

where (a) follows from Cauchy-Schwarz, and (b) follows from Fact 4.2. By taking square roots and a supremum over all unit vectors vv, we obtain the desired conclusion.

where the last line follows from subgaussian goodness, and applying the first claim with wi′=1n−wiw^{\prime}_{i}=\frac{1}{n}-w_{i}. ∎

As before, we will require a lemma which relates the mean shift caused by a small fraction of points to spectral deviations. However, because in this case we will assume that our data is subgaussian, we will be able to prove stronger statements, which will in turn allow us to achieve much better error. We first record the following simple fact, which states that if we have a set of weights that puts almost all of its mass on a good set, then the restriction of that set of weights to the good set satisfies the conditions of the lemmata proved in the above section.

Let ε<1/2\varepsilon<1/2, and suppose S=Sg∪Sb∖SrS=S_{g}\cup S_{b}\setminus S_{r}, where SgS_{g} is (ε,γ1,γ2,β1,β2)(\varepsilon,\gamma_{1},\gamma_{2},\beta_{1},\beta_{2})-s.g. good, and ∣Sb∣,∣Sr∣≤ε∣S∣|S_{b}|,|S_{r}|\leq\varepsilon|S|. Let w∈Sn,εw\in\mathfrak{S}_{n,\varepsilon}. Then wg≤1∣Sg∣1Sgw_{g}\leq\frac{1}{|S_{g}|}\mathbf{1}_{S_{g}} and ∣1∣Sg∣1Sg−wg∣≤2ε\left|\frac{1}{|S_{g}|}\mathbf{1}_{S_{g}}-w_{g}\right|\leq 2\varepsilon.

We first show that, no matter what, the smallest eigenvalue of the empirical covariance we choose cannot be too small. Formally, for the remainder of the section, let

Let γ1,γ2,β1,β2>0\gamma_{1},\gamma_{2},\beta_{1},\beta_{2}>0. Suppose S=Sg∪Sb∖SrS=S_{g}\cup S_{b}\setminus S_{r}, where SgS_{g} is (ε,γ1,γ2,β1,β2)(\varepsilon,\gamma_{1},\gamma_{2},\beta_{1},\beta_{2})-s.g. good, and ∣Sb∣,∣Sr∣≤ε∣S∣|S_{b}|,|S_{r}|\leq\varepsilon|S|. Let w∈Sn,εw\in\mathfrak{S}_{n,\varepsilon}. Then

Let w′∈Sn,εw^{\prime}\in\mathfrak{S}_{n,\varepsilon} be defined by wi′=wiw^{\prime}_{i}=w_{i} if i∈Sg∩Si\in S_{g}\cap S and wi′=0w^{\prime}_{i}=0 otherwise. By Lemma 3.4, we know that

Let γ1,γ2>0\gamma_{1},\gamma_{2}>0. Suppose S=Sg∪Sb∖SrS=S_{g}\cup S_{b}\setminus S_{r}, where SgS_{g} is (ε,γ1,γ2,β1,β2)(\varepsilon,\gamma_{1},\gamma_{2},\beta_{1},\beta_{2})-s.g. good, and ∣Sb∣,∣Sr∣≤ε∣S∣|S_{b}|,|S_{r}|\leq\varepsilon|S|. Let w∈Sn,εw\in\mathfrak{S}_{n,\varepsilon}, and let λ=∥M(wt)−\Id∥2\lambda=\left\lVert M(w_{t})-\Id\right\rVert_{2}. Then

Before we prove this lemma, observe that if γ1=O(εlog⁡1/ε),γ2=O(εlog⁡1/ε),β1=O(log⁡1/ϵ),β2=O(log⁡(1/ϵ))\gamma_{1}=O(\varepsilon\sqrt{\log 1/\varepsilon}),\gamma_{2}=O(\varepsilon\log 1/\varepsilon),\beta_{1}=O(\sqrt{\log 1/\epsilon}),\beta_{2}=O(\log(1/\epsilon)), and ε≤1/2\varepsilon\leq 1/2 then the RHS of the lemma simplifies to O(εlog⁡1/ε)O(\varepsilon\sqrt{\log 1/\varepsilon}).

Let ρ=μ(w)−μ\rho=\mu(w)-\mu. As before, we have the following sequence of identities:

We treat the two terms on the RHS separately. We first consider W0W_{0}. We continue expanding, and observe:

where (a) follows from two applications of Corollary 4.3, and (b) follows from Cauchy-Schwarz and subgaussian goodness.

We now turn our attention to bounding W1W_{1}. We have

Focusing in on the first term in the RHS, we have

where (a) follows from Cauchy-Schwarz. and (b) follows since ww places at most ε\varepsilon mass on SbS_{b}. Now observe that

by Fact 4.2, where we take the convention that wi=0w_{i}=0 for i∈Sri\in S_{r}. Hence, combining terms, recalling the definition of λ=∥M(wt)−\Id∥2\lambda=\left\lVert M(w_{t})-\Id\right\rVert_{2}, and taking square roots, we have

Solving for ∥ρ∥2\left\lVert\rho\right\rVert_{2} yields the desired claim. ∎

2 Algorithm description

The algorithm is quite similar to the algorithm presented in Section 3 for the bounded covariance case. The formal pseudocode is presented in Algorithm 4. For any w∈Γnw\in{\Gamma}_{n}, let μ(w)\mu(w) and M(w)M(w) be as in Section 3. However, we will require a slightly stronger notion of score oracle than before.

Recall that before, given a dataset SS, and a sequence of weights w0,…,wt−1w_{0},\ldots,w_{t-1}, the score oracle is asked to produce multiplicative approximations to τt,i\tau_{t,i} where τt,i\tau_{t,i} is defined as (10). One consequence of this is that this allows us to produce multiplicative approximations to ⟨M(wt(s)),Ut(s)⟩=∑i=1nwt,iτt,i\left\langle M(w_{t}^{\left(s\right)}),U_{t}^{\left(s\right)}\right\rangle=\sum_{i=1}^{n}w_{t,i}\tau_{t,i}. However, we will require multiplicative approximations to ⟨M(wt(s))−\Id,Ut(s)⟩\left\langle M(w_{t}^{\left(s\right)})-\Id,U_{t}^{\left(s\right)}\right\rangle, which cannot be obtained black-box via multiplicative approximations to the original scores.

Given SS and such an oracle O∗\mathscr{O}^{*}, the algorithm again proceeds in epochs. Initially, we let w(0)=1n1nw^{\left(0\right)}=\frac{1}{n}\mathbf{1}_{n}. In epoch s=0,…,L−1s=0,\ldots,L-1, we proceed as follows. First, compute λ(s)≈0.1∥M(w(s))−\Id∥2\lambda^{(s)}\approx_{0.1}\left\lVert M(w^{\left(s\right)})-\Id\right\rVert_{2}. If λ(s)≤O(ξ)\lambda^{(s)}\leq O\left(\xi\right), we terminate and output μ(w(s))\mu(w^{\left(s\right)}).

Otherwise, we let w0(s)=wsw^{\left(s\right)}_{0}=w^{s}. Then, in iteration t=0,…,Ts−1t=0,\ldots,T_{s}-1, we first (approximately) compute λt(s)≈0.1∥M(wt(s))−\Id∥2\lambda^{\left(s\right)}_{t}\approx_{0.1}\|M(w^{\left(s\right)}_{t})-\Id\|_{2}. If λt(s)≤12λ0(s)\lambda_{t}^{\left(s\right)}\leq\frac{1}{2}\lambda_{0}^{\left(s\right)}, we terminate and let w(s+1)=wt(s)w^{\left(s+1\right)}=w_{t}^{\left(s\right)}. Otherwise, we let Ut(s)U_{t}^{\left(s\right)} be prescribed by the MMW update with parameter α=1/(1.1⋅λ(s))\alpha=1/(1.1\cdot\lambda^{\left(s\right)}). Then, produce the gain matrix is given as follows.

That is, we find the largest 2ε2\varepsilon-percentile of the scores weighted by the current weights, and run the univariate filter on these set of weights, leaving the other weights unchanged. Finally, we output the gain matrix Ft(s)=M(wt+1(s))−\IdF^{\left(s\right)}_{t}=M(w^{\left(s\right)}_{t+1})-\Id. Notice that this matrix may not be PSD.

Observe that the fact that the Ft(s)F^{\left(s\right)}_{t} includes a negative identity term does not affect these scores at all, and indeed we can take Ut(s)U_{t}^{\left(s\right)} to be as in (11), since the parameter cc is chosen in any case to normalize Ut(s)U_{t}^{\left(s\right)} to have trace 11.

As before, the choice of constants here is arbitrary, and any constants sufficiently small will work. In Section 5 we construct such an approximate augmented score oracle in nearly-linear time.

3 Correctness of s.g.-QUEScoreFilter

The rest of this section is dedicated to the proof of the following theorem:

The following invariants always hold. There exists some universal constant C>0C>0 so that for all epochs ss, we have:

w(s)∈Sn,εw^{\left(s\right)}\in\mathfrak{S}_{n,\varepsilon}, and

then epoch ss terminates after O(log⁡d)O(\log d) iterations, and outputs w(s+1)w^{\left(s+1\right)} so that ∥M(w(s))−\Id∥2≤34∥M(w(s))−\Id∥2\left\lVert M(w^{\left(s\right)})-\Id\right\rVert_{2}\leq\frac{3}{4}\left\lVert M(w^{\left(s\right)})-\Id\right\rVert_{2}.

We first demonstrate how this lemma proves Theorem 4.7.

By our condition on M(1n1n)M(\tfrac{1}{n}\mathbf{1}_{n}), after at most s=O(log⁡κ2)s=O(\log\kappa_{2}) iterations, we must have that

Since w(s)∈Sn,εw^{(s)}\in\mathfrak{S}_{n,\varepsilon}, Lemma 4.6 implies that for ε<c\varepsilon<c sufficiently small, we have

We now turn to bounding the runtime. As in Theorem 3.5, it is clear that we make at most log⁡d\log d calls to the oracle every epoch, and 1DFilter runs in time O(nlog⁡κ1)O(n\log\kappa_{1}). Moreover, the approximate eigenvalue computations can still be done in O~(nd)\widetilde{O}(nd) time since we may run power method on M(ws(t))−\IdM(w_{s}^{(t)})-\Id, as we can evaluate matrix-vector multiplications against this matrix in O(nd)O(nd) time. This completes the proof. ∎

The proof of Lemma 4.8 breaks down into two parts. First, we will show that assuming we have not yet made sufficient progress, we remain in the regime where the filter is guaranteed to make progress, i.e., the majority of the mass of the τi\tau_{i} are from bad points. This is captured in the following lemma:

At time tt, suppose that ⟨Mt−\Id,Ut⟩>11.1⋅5λ0\left\langle M_{t}-\Id,U_{t}\right\rangle>\frac{1}{1.1\cdot 5}\lambda_{0}. Then wt+1∈Sn,εw_{t+1}\in\mathfrak{S}_{n,\varepsilon} and ⟨Ft,Ut⟩≤0.34⋅⟨Ft−1,Ut⟩\left\langle F_{t},U_{t}\right\rangle\leq 0.34\cdot\left\langle F_{t-1},U_{t}\right\rangle.

Then, we will show that this implies that the regret bounds of MMW guarantee that we make constant progress in logarithmically many iterations:

Suppose for all t=0,…,T−1t=0,\ldots,T-1, Lemma 4.9 holds, where T=O(log⁡d)T=O(\log d). Then, ∥M(wT)−\Id∥2≤0.63⋅∥M(w0)−\Id∥2\left\lVert M(w_{T})-\Id\right\rVert_{2}\leq 0.63\cdot\left\lVert M(w_{0})-\Id\right\rVert_{2}.

The condition that ⟨Mt−\Id,Ut⟩>11.1⋅5λ0\left\langle M_{t}-\Id,U_{t}\right\rangle>\frac{1}{1.1\cdot 5}\lambda_{0} implies that in this case, we will run the univariate filter. Let Sg′=Sg∩[m]S^{\prime}_{g}=S_{g}\cap[m] and let Sb′=Sb∩[m]S^{\prime}_{b}=S_{b}\cap[m], and let wg′w^{\prime}_{g} and wb′w^{\prime}_{b} the restriction of wtw_{t} to Sg′S^{\prime}_{g} and Sb′S^{\prime}_{b}, respectively. Observe that ∑i∈Sb′wi≤∑i∈Sbwi≤ε\sum_{i\in S^{\prime}_{b}}w_{i}\leq\sum_{i\in S_{b}}w_{i}\leq\varepsilon, and therefore ∑i∈Sg′wi∈[ε,2ε]\sum_{i\in S^{\prime}_{g}}w_{i}\in[\varepsilon,2\varepsilon]. We then have

We now turn to lower bound the contribution from Sb′S_{b}^{\prime}. First observe that

where (a) follows from Fact 4.2 and since ∣wb∣≤ε|w_{b}|\leq\varepsilon, and the last inequality follows by our assumption on ⟨M(wt)−\Id,Ut⟩\left\langle M(w_{t})-\Id,U_{t}\right\rangle. Therefore

where (a) follows since mm is the 2ε2\varepsilon-percentile, (b) follows from the guarantee of Theorem 2.4, (c) follows from (27), and (d) follows from our assumption on λt\lambda_{t}. Rearranging terms completes the proof. ∎

We now show that this is enough to guarantee Lemma 4.10, which guarantees we make constant multiplicative progress in every epoch.

Observe that if we terminate prematurely we clearly satisfy the lemma. Thus we may assume we do not terminate until timestep T−1T-1. Lemma 4.9 then implies that no matter which update we do at time tt for t=0,…,T−1t=0,\ldots,T-1, we have the guarantee that

Moreover, by Lemma 3.4, we have that M(wt)−\Id⪯M(w0)−\IdM(w_{t})-\Id\preceq M(w_{0})-\Id, and hence 1α(M(wt)−\Id)⪯I\frac{1}{\alpha}\left(M(w_{t})-\Id\right)\preceq I by our choice of α\alpha. Therefore by our regret bound, we have

By Lemma 4.5, we know that for all t=0,…,T−1t=0,\ldots,T-1, we must have

This will allow us to simplify a number of expressions. In particular, since M(wt)−\Id⪯M(w0)−\IdM(w_{t})-\Id\preceq M(w_{0})-\Id, this implies that all positive eigenvalues of M(wt)−\IdM(w_{t})-\Id are smaller than λ0\lambda_{0}, and (30) implies that all negative eigenvalues are bounded in absolute value by λ0\lambda_{0}, by our assumption on λ0\lambda_{0}. Hence

Finally, we observe that (30) and Lemma 3.4 together imply that either

In the case of (33), we are clearly done, so we may assume that we are in the case of (34). Thus, plugging in (31), (32), and (34) into (29), and dividing by TT, we obtain

where (a) follows from (28), and (b) follows since T=Θ(log⁡d)T=\Theta(\log d), and since ∥M(w0)−\Id∥2\left\lVert M(w_{0})-\Id\right\rVert_{2} is a large constant factor larger than γ2+2γ12+O(εlog⁡1/ε)\gamma_{2}+2\gamma_{1}^{2}+O(\varepsilon\log 1/\varepsilon), by assumption. This completes the proof. ∎

Fast approximate score oracles

Our main result in this section is the following, which says that it is possible to achieve such approximations with high probability in nearly linear time:

If the output of ApproxScores satisfies the conditions of Lemma 5.1, we say that ApproxScores succeeds.

We need a few tools which are standard in the design of fast algorithms based on matrix multiplicative weights. The first is the standard Johnson-Lindenstrauss dimension reduction lemma:

Let Φ∈Rr×d\Phi\in\R^{r\times d} be a matrix whose entries are i.i.d. samples from N(0,1/r)\mathcal{N}(0,1/r). For every vector u∈Rdu\in\R^{d} and every ϵ∈(0,1)\epsilon\in(0,1),

We also require the following, slightly stronger version of the JL guarantee, which states that it preserves matrix inner products:

Let A,U∈Rd×dA,U\in\R^{d\times d}. Suppose U=BB⊤U=BB^{\top} for some symmetric BB. Let S∈Rr×dS\in\R^{r\times d} have i.i.d. entries from N(0,1/r)\mathcal{N}(0,1/r). There is a universal constant cc such that for all ϵ>0\epsilon>0,

Notice that \E[⟨A,BS⊤SB⟩=⟨A,U⟩]\E\left[\langle A,BS^{\top}SB\rangle=\langle A,U\rangle\right]. By the Hanson-Wright inequality together with standard arguments about averages of i.i.d. sub-exponential random variables, for every t>0t>0,

To finish the proof it will be enough to show that

We will also make use of Taylor series approximations to the matrix exponential function. The next lemma helps to control the errors incurred by such approximations.

(Note that when implementing our outlier detction algorithms we approximate the matrix exponential by Chebyshev polynomials rather than Taylor series.)

2 Efficient approximate score oracles

The estimate for the scores will then be given by

and the estimate for qt,iq_{t,i} will be given by

The formal pseudocode is given in Algorithm 5.

We first demonstrate that ApproxScores indeed runs in the claimed runtime:

\textscApproxScores(S,w0,…,wt,δ)\textsc{ApproxScores}(S,w_{0},\ldots,w_{t},\delta) runs in time O~(tndlog⁡1/δ)\widetilde{O}(tnd\log 1/\delta).

Note that ApproxScores is an approximate augmented score oracle, and so it is also clearly an approximate score oracle. In the remainder of this section, we show:

We now condition on the event that the following three events hold simultaneously:

By our choice of δ′\delta^{\prime}, Lemma 5.2, and a union bound, we know that (40) holds with probability at least 1−δ/31-\delta/3. By instantiating Lemma 5.3 with A=IA=I and A=M(wt)−\IdA=M(w_{t})-\Id respectively, we also know that (41) and (42) each hold with probability at least 1−δ/31-\delta/3. Thus, by a union bound, all three conditions hold simultaneously with probability at least 1−δ1-\delta. We claim that conditioned on these three events, the conditions of the lemma are satisfied. Indeed, we have

Lemmata 5.5 and 5.6 together immediately imply Lemma 5.1.

Robust mean estimation: putting it all together

In this section, we formally combine the guarantees derived in the previous sections to prove Theorems 2.1 and 2.2.

Given the machinery we’ve developed, the algorithm is straightforward to describe. Given a corrupted dataset SS and δ>0\delta>0, run \textscNaivePrune(S,4dn/δ,δ/4)\textsc{NaivePrune}(S,\sqrt{4dn/\delta},\delta/4) to obtain a pruned dataset S′S^{\prime}. Center all points in S′S^{\prime} with the empirical mean of S′S^{\prime}. Then, run \textscQUEScoreFilter(S′,\textscApproxScores)\textsc{QUEScoreFilter}(S^{\prime},\textsc{ApproxScores}), with κ=4dn/δ\kappa=\sqrt{4dn/\delta}, and the δ\delta parameter in ApproxScores set to O(δ/(log⁡κlog⁡d))O(\delta/(\log\kappa\log d)). The formal pseudocode is presented in Algorithm 6.

Recall that by definition, we may assume that S=T∪Sb∖SrS=T\cup S_{b}\setminus S_{r}, where TT is a set of nn i.i.d. samples from DD, and ∣Sb∣,∣Sr∣≤εn|S_{b}|,|S_{r}|\leq\varepsilon n. Let γ1,γ2\gamma_{1},\gamma_{2} be as in (9). We condition on four events:

∥Xi−μ∥2≤4dnδ\left\lVert X_{i}-\mu\right\rVert_{2}\leq\sqrt{\frac{4dn}{\delta}} for all i∈Ti\in T,

\textscNaivePrune(S′,4dn/δ,δ/4)\textsc{NaivePrune}(S^{\prime},\sqrt{4dn/\delta},\delta/4) succeeds,

T=Sg∪TbT=S_{g}\cup T_{b}, where SgS_{g} is (γ1,γ2)(\gamma_{1},\gamma_{2})-good with respect to DD, and ∣Tb∣≤εn|T_{b}|\leq\varepsilon n, and

every time it is called, ApproxScores suceeds.

By Chebyshev’s inequality, and an union bound over all nn points in TT, the first bullet point holds with probability at least δ/4\delta/4. By a further union bound and by adjusting constants in our choices of δ\delta, all four of these conditions hold simultaneously with probability at least 1−δ−exp⁡(−εn)1-\delta-\exp(-\varepsilon n). We now claim that, conditional on these four events, we output a μ(w)\mu(w) so that ∥μ−μ(w)∥2=O(ε)+O~(d/(nδ))\left\lVert\mu-\mu(w)\right\rVert_{2}=O(\sqrt{\varepsilon})+\widetilde{O}(\sqrt{d/(n\delta)}). Indeed, the first two conditions imply that NaivePrune does not throw away any points in TT, and moreover, all points XX in the set S′S^{\prime} satisfy ∥Xi∥2≤4dn/δ\left\lVert X_{i}\right\rVert_{2}\leq\sqrt{4dn/\delta} after centering. Thus, since the scores output by ApproxScores satisfy the necessary conditions for Theorem 3.5, it follows that the final output satisfies ∥μ−μ(w)∥2=O(ε)+O~(d/(nδ))\left\lVert\mu-\mu(w)\right\rVert_{2}=O(\sqrt{\varepsilon})+\widetilde{O}(\sqrt{d/(n\delta)}), as claimed.

We now turn to runtime. Since each epoch runs for at most O(log⁡d)O(\log d) iterations, and so we run for at most O(log⁡κlog⁡d)O(\log\kappa\log d) iterations, the total time spent running ApproxScores is at most O~(ndlog⁡1/δ)\widetilde{O}(nd\log 1/\delta). Thus overall the algorithm runs in time O~(ndlog⁡1/δ)\widetilde{O}(nd\log 1/\delta), as claimed. ∎

2 Proof of Theorem 2.2

Again, the algorithm is straightforward. Given a corrupted dataset SS, parameters ε>0\varepsilon>0 and δ>0\delta>0, run \textscNaivePrune(S,4dlog⁡(n/δ),δ/4)\textsc{NaivePrune}(S,\sqrt{4d\log(n/\delta)},\delta/4) to obtain a pruned dataset S′S^{\prime}. Center all points in S′S^{\prime} with the empirical mean of S′S^{\prime}. Then, as above, run \textscs.g.−QUEScoreFilter(S′,ε,\textscApproxScores)\textsc{s.g.-QUEScoreFilter}(S^{\prime},\varepsilon,\textsc{ApproxScores}), with κ=4dlog⁡(n/δ)\kappa=\sqrt{4d\log(n/\delta)}, and the δ\delta parameter in ApproxScores set to O(δ/(log⁡κ/εlog⁡d))O(\delta/(\log\kappa/\varepsilon\log d)). The formal pseudocode is presented in Algorithm 7.

We now prove correctness. The proof is very similar to the proof presented above.

Recall that by definition, we may assume that S=Sg∪Sb∖SrS=S_{g}\cup S_{b}\setminus S_{r}, where TT is a set of nn i.i.d. samples from DD, and ∣Sb∣,∣Sr∣≤εn|S_{b}|,|S_{r}|\leq\varepsilon n. Let γ1,γ2,β1,β2\gamma_{1},\gamma_{2},\beta_{1},\beta_{2} be as in (16) and (17), and let ξ\xi be as in (21). We condition on four events:

∥Xi−μ∥2≤4dlog⁡(n/δ)\left\lVert X_{i}-\mu\right\rVert_{2}\leq\sqrt{4d\log(n/\delta)} for all i∈Sgi\in S_{g},

\textscNaivePrune(S′,4dlog⁡(n/δ),δ/4)\textsc{NaivePrune}(S^{\prime},\sqrt{4d\log(n/\delta)},\delta/4) succeeds,

SgS_{g} is (ε,γ1,γ2,β1,β2)(\varepsilon,\gamma_{1},\gamma_{2},\beta_{1},\beta_{2})-s.g. good with respect to DD,

every time it is called, ApproxScores suceeds.

By standard concentration inequalities for chi-squared random variables, and an union bound over all nn points in TT, the first bullet point holds with probability at least δ/4\delta/4. By a further union bound and by adjusting constants in our choices of δ\delta, all four of these conditions hold simultaneously with probability at least 1−δ1-\delta. We now claim that, conditional on these four events, we output a μ(w)\mu(w) so that

Notice that in this case, by our choice of ξ\xi, and for ε≤1/2\varepsilon\leq 1/2 we have that

Letting A=Cd+log⁡1/δnA=C\frac{d+\log 1/\delta}{n} for some constant CC sufficiently large, by (16) and (17), we now have the following inequalities for each term in the above sum:

where (a) follows from the arithmetic mean-geometric mean inequality. Thus, overall we conclude that, assuming (43), we have

for some universal constants C1,C2C_{1},C_{2} sufficiently large, as desired. It now remains to demonstrate that (43) is satisfied.

The first two conditions imply that NaivePrune does not throw away any points in SgS_{g}, and moreover, all points XX in the set S′S^{\prime} satisfy ∥Xi∥2≤4dlog⁡(n/δ)\left\lVert X_{i}\right\rVert_{2}\leq\sqrt{4d\log(n/\delta)} after centering. By standard arguments, this implies that ∥M(1n1n)−\Id∥2≤O(εlog⁡1/ε+εκ)\left\lVert M(\tfrac{1}{n}\mathbf{1}_{n})-\Id\right\rVert_{2}\leq O(\varepsilon\log 1/\varepsilon+\varepsilon\kappa), for κ=dlog⁡(n/δ)\kappa=\sqrt{d\log(n/\delta)}. Thus, since the scores output by ApproxScores satisfy the necessary conditions for Theorem 3.5, it follows that the final output satisfies ∥μ−μ(w)∥2=O(γ1+εlog⁡1/ε+ε(γ1+γ2)\left\lVert\mu-\mu(w)\right\rVert_{2}=O(\gamma_{1}+\varepsilon\sqrt{\log 1/\varepsilon}+\sqrt{\varepsilon(\gamma_{1}+\gamma_{2}}), as claimed.

We now turn to runtime. Since each epoch runs for at most O(log⁡d)O(\log d) iterations, and so we run for at most O(log⁡κ/εlog⁡d)O(\log\kappa/\varepsilon\log d) iterations, the total time spent running ApproxScores is at most O~(ndlog⁡1/δlog⁡1/ε)\widetilde{O}(nd\log 1/\delta\log 1/\varepsilon). Thus overall the algorithm runs in time O~(ndlog⁡1/δlog⁡1/ε)\widetilde{O}(nd\log 1/\delta\log 1/\varepsilon), as claimed. ∎

Outlier detection: additional experiments and fast implementation

In this section we compare QUE scoring against some additional outlier detection methods from prior literature. We also discuss and describe experiments involving our nearly-linear time implementation of QUE scoring.

The work compares a number of outlier detection methods (mainly those based on kk-NN distances) on several datasets, both low and high dimensional. We evaluate QUE scoring on the InternetAds dataset from , with a 0.10.1-fraction of outliers. Unlike the experiments on our CIFAR-10 and text embedding data, to replicate the experimental setting of prior work as closely as possible we perform no whitening or other preprocessing.

We find that QUE scoring is outperformed by LOF/kk-NN-based methods on the InternetAds dataset. Choosing α=4\alpha=4 for QUE, we find the ROCAUC scores in the below table.

To elucidate the difference between the InternetAds setting where kk-NN methods perform well and the other experimental settings in this paper, we offer the following histograms demonstrating that the distribution of nearest-neighbor distances is markedly distinct for inliers and outliers in both data sets, but only in the InternetAds dataset do inliers have smaller kk-NN distances.

2 Scaling up: a nearly-linear time implementation of QUE scoring

Most of the experiments we present involving QUE scores employ the following approach to compute them. Given X1,…,Xn∈RdX_{1},\ldots,X_{n}\in\R^{d}, explicitly form the empirical covariance Σ‾\overline{\Sigma} in memory. Use SciPy’s expm function to compute the matrix exponential U=exp⁡(αΣ‾)U=\exp(\alpha\overline{\Sigma}), then compute τi=(Xi−μ‾)⊤U(Xi−μ‾)\tau_{i}=(X_{i}-\overline{\mu})^{\top}U(X_{i}-\overline{\mu}). (This in turn uses the scaling and squaring algorithm for the matrix exponential of Al-Mohy and Higham .)

While we are already able to run experiments in 10001000 or more dimensions using this approach, it requires at least d2d^{2} memory to store the covariance, and somewhat more time to form and exponentiate it. We also implement an approximate method to compute QUE scores, whose running time is O~(nd)\widetilde{O}(nd). We demonstrate in this section that outlier detection from approximate QUE scores still improves over baseline methods on several data sets. The technique here is very similar to the one used in Section 5 to approximate the scores used in the fast robust mean estimation algorithm. At a high level, the idea is the same: approximate the exponential with a low-degree polynomial, and sketch this using Johnson-Lindenstrauss matrices. However, we make a couple of additional optimizations here.

We use the following approximate method, inspired by our sketching approach to compute QUE scores from our nearly linear time algorithm for robust mean estimation.

Approximate the matrix exponential exp⁡(M)\exp(M) by Chebyshev polynomials of degree O(log⁡d)O(\log d), along with scaling and squaring when ∥M∥2>1\|M\|_{2}>1 .

For Σ‾\overline{\Sigma} the empirical covariance of X1,…,XnX_{1},\ldots,X_{n}, use fast versions of the Johnson-Lindenstrauss method to approximate ⟨Xi,Σ‾jXi⟩\langle X_{i},\overline{\Sigma}^{j}X_{i}\rangle for all i≤ni\leq n and j≤O(log⁡d)j\leq O(\log d).

Note that using the expansion into powers Σ‾j\overline{\Sigma}^{j}, right or left matrix-vector multiplication by P(αΣ‾/2∥Σ‾∥2)P(\alpha\overline{\Sigma}/2\|\overline{\Sigma}\|_{2}) can be accomplished in O(ndlog⁡d)O(nd\log d) time. As in the fast JL transform , we take S=S′⋅D⋅HS=S^{\prime}\cdot D\cdot H where S′S^{\prime} is a sparse random matrix, DD is a diagonal matrix with random ±1\pm 1 entries, and HH is a Hadamard matrix. Fast Fourier transform methods may be used to compute matrix-vector multiplications SXSX in d(log⁡d)O(1)d(\log d)^{O(1)} time , leading to nearly-linear running time of this approach in theory. In practice, we use standard matrix multiplication; this still allows for experiments in thousands of dimensions.

3 Approximate whitening

Using approximate QUE scores reduces the running time of our outlier detection algorithm from quadratic to nearly-linear if whitened data is already available or there is no desire to preprocess/whiten the data. However, as we discussed in Section 1.5, QUE scoring works best with whitened data. If given a corrupted dataset X=X1,…,XnX=X_{1},\ldots,X_{n} and a clean dataset Y=Y1,…,YmY=Y_{1},\ldots,Y_{m} which is distributed similarly to the inliers of the dataset XX, we would like to compute whitened data Xi′=(\E(Yi−μ(Y))(Yi−μ(Y))⊤)−1⋅XiX_{i}^{\prime}=(\E(Y_{i}-\mu(Y))(Y_{i}-\mu(Y))^{\top})^{-1}\cdot X_{i}. Unfortunately, even forming the matrix (\E(Yi−μ(Y))(Yi−μ(Y))⊤)−1(\E(Y_{i}-\mu(Y))(Y_{i}-\mu(Y))^{\top})^{-1} requires quadratic time (and computing the matrix inverse is slower still).

We investigate an approximate whitening procedure which avoids computing the entire matrix (\E(Yi−μ(Y))(Yi−μ(Y))⊤)−1(\E(Y_{i}-\mu(Y))(Y_{i}-\mu(Y))^{\top})^{-1}. Instead, we compute the top kk eigenvectors and eigenvalues λi,vi\lambda_{i},v_{i} of (\E(Yi−μ(Y))(Yi−μ(Y))⊤)(\E(Y_{i}-\mu(Y))(Y_{i}-\mu(Y))^{\top}) and approximate the inverse as ∑i≤k(1/λi)vivi⊤+Π⊥\sum_{i\leq k}(1/\lambda_{i})v_{i}v_{i}^{\top}+\Pi_{\perp}, where Π⊥\Pi_{\perp} is the projector to the orthogonal complement of span{v1,…,vk}span\{v_{1},\ldots,v_{k}\}. We use k=0.3dk=0.3d and demonstrate that even in conjunction with our approximate QUE scoring algorithm we still obtain a nonnegligible improvement over baseline methods.

References

Appendix A Deferred details from Section 2

The algorithm is straightforward: choose a random point in SS, and check if strictly more than n/2n/2 points lie within a ball of radius 2r2r around this point. If so, include all points with distance at most 4r4r from this point. If not, repeat, and run for O(log⁡1/δ)O(\log 1/\delta) iterations. We now prove correctness.

By the triangle inequality, if we ever randomly select a point from S′S^{\prime}, then we terminate, and in this case it is easy to see that the output satisfies the desired property. Thus, it is easy to see that the probability we have not terminated after tt iterations is at most 2−t2^{-t}. Suppose we have terminated. Then in that iteration, we selected a point X∈SX\in S that has distance at most 2r2r to more than n/2n/2 other points in SS. This implies that it has distance at most 2r2r to some point in S′S^{\prime}. By triangle inequality, this implies that all points in S′S^{\prime} are at distance at most 4r4r from XX, and so the output in this iteration must satisfy the claims of the Lemma. ∎

We note that if one wishes to obtain a deterministic linear-time algorithm for this problem, it is also possible to do so, albeit using radius O(rd)O(r\sqrt{d}). The algorithm is again simple: simply take the coordinate-wise median of all the data points, and take all points with distance at most O(rd)O(r\sqrt{d}) from this point. It is not hard to see that the coordinate-wise median can differ in each coordinate from the points in S′S^{\prime} by at most rr, and so its distance to each point in S′S^{\prime} can be at most rdr\sqrt{d}. While this is worse by a polynomial factor than the guarantee obtained above, since in the end our overall guarantees depend only logarithmically on rr, this does not change our runtime guarantees by more than a logarithmic factor.

A.2 Omitted details from Section 2.4

The algorithm 1DFilter is quite simple. For i=1,…,mi=1,\ldots,m, and for any positive integer tt, define

Observe that the FtF_{t} form a monotone decreasing sequence. The algorithm will simply find the smallest t∈{1,…,τmax⁡ebσ}t\in\{1,\ldots,\frac{\tau_{\max}}{eb\sigma}\} so that Ft≤bσF_{t}\leq b\sigma via binary search, and outputs w(t)w^{\left(t\right)}. The formal pseudocode for the algorithm is given in Algorithm 8.

We now prove that this algorithm satisfies Theorem 2.4. We say any set of weights w′w^{\prime} satisfying ∑i∈Sgwi−wi′≤∑i∈Sbwi−wi′\sum_{i\in S_{g}}w_{i}-w_{i}^{\prime}\leq\sum_{i\in S_{b}}w_{i}-w_{i}^{\prime} is admissible. We first show that the sequence of weights we produce is always admissible, under some mild conditions:

Let tt be an integer so that w(t)w^{\left(t\right)} is admissible, and Ft>2ησF_{t}>2\eta\sigma. Then w(t+1)w^{\left(t+1\right)} is admissible.

Because w(t)≤ww^{\left(t\right)}\leq w, we have that ∑i∈Sgwi(t)τi≤ησ\sum_{i\in S_{g}}w^{\left(t\right)}_{i}\tau_{i}\leq\eta\sigma. As a result, if Ft≥2ησF_{t}\geq 2\eta\sigma, we must have ∑i∈Sbwi(t)τi>σ/2\sum_{i\in S_{b}}w^{\left(t\right)}_{i}\tau_{i}>\sigma/2. Therefore, we have the following two inequalities:

Consequently, we remove more mass from the weights in SbS_{b} than from SgS_{g} in going from w(t)w^{\left(t\right)} to w(t+1)w^{\left(t+1\right)}. Since by assumption w(t)w^{\left(t\right)} is admissible, this immediately implies that w(t+1)w^{\left(t+1\right)} is admissible as well. ∎

By induction, Lemma A.1 guarantees that the output weights remain admissible, and the termination condition of the algorithm guarantees that the output satisfies (5). It suffices to bound the runtime of the algorithm.

First, observe that there must exist a valid TT in the range we are searching. We first observe that

For any constant A>0A>0, the maximizer of the function g(x)=xexp⁡(−Ax)g(x)=x\exp(-Ax) in the range x∈[0,∞)x\in[0,\infty) is achieved by x=1Ax=\frac{1}{A}, so g(x)≤1eAg(x)\leq\frac{1}{eA} for all x∈[0,∞)x\in[0,\infty). Setting A=t/τmax⁡A=t/\tau_{\max}, and letting t=τmax⁡ebσt=\frac{\tau_{\max}}{eb\sigma}, we conclude that

Thus, there exists some tt within our specified range which satisfies the conclusion. Finally, to bound the runtime, observe that every iteration runs in O(n)O(n) time, This is true in the real RAM model; in practice we can run any iteration in O(mlog⁡(τmax⁡/σ))O(m\log(\tau_{\max}/\sigma)) time by exponentiation via repeated doubling to compute all the wi(t)w^{\left(t\right)}_{i}, so we pay at most an additional log factor and we can run for at most O(log⁡τmax⁡/(bσ))O(\log\tau_{\max}/(b\sigma)) iterations, which completes the proof. ∎

A.3 The randomized hard filter

In this section we show that a randomized outlier removal method, rather than soft downweighting, can achieve the more or less the same guarantees as 1DFilter. Formally, we show:

Let η∈(0,1/2)\eta\in(0,1/2), let b≥2ηb\geq 2\eta, and let s,δ>0s,\delta>0. Let mm satisfy

Let τ1,…,τm\tau_{1},\ldots,\tau_{m} be non-negative scalars, and let τmax⁡=max⁡i∈[m]τi\tau_{\max}=\max_{i\in[m]}\tau_{i}. Suppose there exist two disjoint sets Sg,SbS_{g},S_{b} so that Sg∪Sb=[m]S_{g}\cup S_{b}=[m], and moreover,

Then \textscRandomFilter(w,τ)\textsc{RandomFilter}(w,\tau) runs in time O((1+log⁡τmax⁡bσ)m)O\left(\left(1+\log\frac{\tau_{\max}}{b\sigma}\right)m\right) and outputs S′⊆SS^{\prime}\subseteq S so that with probability 1−δ1-\delta, we have:

not too many more points from SgS_{g} are removed than from SbS_{b} i.e.

the sum of the τ\tau has decreased, i.e. S′S^{\prime} satisfies

The algorithm itself is very easy to describe. First, let T=[m]T=[m]. Then, while ∑i∈Tτi>bσ\sum_{i\in T}\tau_{i}>b\sigma, throw away each point from TT with probability τi/τmax⁡(T)\tau_{i}/\tau_{\max}(T), where τmax⁡(T)=max⁡i∈Tτi\tau_{\max}(T)=\max_{i\in T}\tau_{i}, and let TT be the set of remaining points. At termination, we simply output the set S′=TS^{\prime}=T. The formal pseudocode of this algorithm is given in Algorithm 9.

As a brief aside, we note that this differs slightly from the algorithm presented in , as there the algorithm randomly selects a threshold, and throws away all points above this threshold. However, the key property which the previous algorithm used of this random threshold was that for all i∈Ti\in T, we had that \Pr[\mbox{iis thrown out}]=\tau_{i}/\tau_{\max}(T). Therefore a very similar analysis can be adapted for either case. However, the algorithm in only succeeds with constant probability, and a martingale-style argument (as in ) is needed to ensure that it works.

The remainder of this section is dedicated to the proof of Theorem A.2. Our first lemma is similar to Lemma A.1.

Suppose that ∑i∈Tτi>bσ\sum_{i\in T}\tau_{i}>b\sigma. Then, if we let T′T^{\prime} be the random set obtained by throwing away each point from TT with probability τi/τmax⁡(T)\tau_{i}/\tau_{\max}(T), then:

For i∈Ti\in T, let YiY_{i} be the random variable which is 11 if we throw out ii in T′T^{\prime} and 00 otherwise. Then

To prove (47), we break into two cases depending on σ/τmax⁡\sigma/\tau_{\max}. Suppose that σ/τmax⁡≥εm/s\sigma/\tau_{\max}\geq\varepsilon m/s. Then by Bernstein’s inequality, we have

Combining these two cases, and simplifying yields the desired claim. ∎

We now show that with high probability, we do not need to repeat this procedure too many times before the sum decreases by a constant factor.

Let δ>0\delta>0, and let t=Ω~(log⁡(τmax⁡mbσ)log⁡(1/δ))t=\widetilde{\Omega}\left(\log\left(\frac{\tau_{\max}m}{b\sigma}\right)\log(1/\delta)\right). Then, the probability that Algorithm 9 runs for more than tt iterations is at most δ\delta.

Let J=log⁡τmax⁡mbσJ=\log\frac{\tau_{\max}m}{b\sigma}. For j=1,…,Jj=1,\ldots,J, let

For all j=1,…,Jj=1,\ldots,J, we claim that conditional on the event that the algorithm has not terminated yet, and all points from Aj′A_{j^{\prime}} have been removed, for j′<jj^{\prime}<j, then after t′t^{\prime} iterations, all points from AjA_{j} have been removed with probability at least 1−m2−t′1-m2^{-t^{\prime}}. Indeed, for all i∈Aji\in A_{j}, in every iteration, if it has not been already removed, then it is removed with probability at least 1/21/2. Thus after t′t^{\prime} iterations, the probability that any point from AjA_{j} remains is at most n2−t′n2^{-t^{\prime}}. Therefore, by a union bound, after Jt′Jt^{\prime} iterations, conditioned on the event that the algorithm hasn’t terminated yet, the probability that any point from AjA_{j} for any jj is at most Jm2−t′Jm2^{-t^{\prime}}. However, if all points from AjA_{j} are removed, for all jj, then if T′T^{\prime} is the remaining set, we have ∑i∈T′τi≤bσ\sum_{i\in T^{\prime}}\tau_{i}\leq b\sigma, so if all such points are removed, then the algorithm must either terminate or have already terminated. This proves the claim by setting t′=log⁡(Jm/δ)t^{\prime}=\log(Jm/\delta). ∎

Theorem A.2 follows from Lemma A.3 and Lemma A.4, by appropriately adjusting parameters.

It is straightforward for the full matrix multiplicative weights algorithm to use the randomized filter rather than the downweighting-based method. Given an ε\varepsilon-corrupted dataset of size nn initally, we do the following. At every instance where we pass to the filter, simply run the randomized filter instead of the downweighting-based method, and output the set of weights which is 1/n1/n for every point that remains after running the randomized filter, and 00 otherwise.

The guarantee of the randomized filter is slightly weaker than the guarantee of the downweighting-based method, so we cannot use black-box use the analysis presented beforehand to also analyze the algorithm instantiated with the weights given by the randomized filter. This is because our guarantee allows for slightly more good points than bad points to be removed per run of the algorithm. However, since the matrix multiplicative weights routine runs for at most polylogarthmically many iterations, by setting s=\polylog⁡(nd)s=\poly\log(nd), we can guarantee that at the end of all of the runs, we have removed at most 2εn2\varepsilon n data points from SgS_{g}. It is straightforward to verify that (up to a factor of 2), the same analysis for matrix multiplicative works with this slightly weaker guarantee, for ε\varepsilon sufficiently small. For conciseness, we omit the proof.

Appendix B Omitted proofs from Section 3

The contents of Section B.1 were added after we were made aware of and hence do not represent independent contributions of the present paper. In this section, we demonstrate the following reduction, which is also implicit in :

Let n∈Nn\in\N and ε∈R\varepsilon\in\R be so that ε>1/n\varepsilon>1/n. Let DD be a distribution over Rd\R^{d} with mean μ\mu and covariance Σ⪯\Id\Sigma\preceq\Id. Let SS be an ε\varepsilon-corrupted set of samples from DD of size nn. Then there is an efficient algorithm which, given SS and ε\varepsilon, produces an 1/101/10-corrupted set of samples of size εn/10\varepsilon n/10 from a distribution D′D^{\prime} with mean μ\mu, and covariance Σ′⪯10ε⋅\Id\Sigma^{\prime}\preceq 10\varepsilon\cdot\Id.

Despite this, we believe that our algorithm is still of independent interest, for a number of reasons. First, our algorithm is much simpler than combining this reduction with the algorithm presented in . We believe this is of independent mathematical interest. Additionally, it is this simplicity which allows us to design a practical outlier detection method, as presented in Section 1.5. Second, this reduction appears to preserve statistical accuracy only in the regime where aim for error bounds as in Theorem 2.1. In particular, it cannot achieve error below Ω(ε)\Omega(\sqrt{\varepsilon}). For instance, if it is combined with the result in for isotropic sub-Gaussian distributions that can achieve error O(εlog⁡1/ε)O(\varepsilon\sqrt{\log 1/\varepsilon}) in time O~(nd)/ε6\widetilde{O}(nd)/\varepsilon^{6}, then the overall algorithm will still achieve error Ω(ε)\Omega(\sqrt{\varepsilon}), which is statistically suboptimal. In contrast, by slightly modifying our algorithm as in Theorem 2.2, we are able to achieve runtime O~(nd)\widetilde{O}(nd) while achieving error O(εlog⁡1/ε)O(\varepsilon\sqrt{\log 1/\varepsilon}), for all ε>0\varepsilon>0 sufficiently small.

The reduction is straightforward: obliviously group the samples in SS into 10εn10\varepsilon n buckets, each of size 110ε\frac{1}{10\varepsilon}, and produce the set S′S^{\prime} which simply takes each bucket, and takes the average the data points in that bucket. First, assume there is no corruption. Then, each bucket contains 1/(10ε)1/(10\varepsilon) i.i.d. samples from DD, and so their average is distributed as D′D^{\prime}, where the mean of D′D^{\prime} is still μ\mu, and their variance is 10εΣ⪯10ε\Id10\varepsilon\Sigma\preceq 10\varepsilon\Id. Since an adversary can only corrupt εn\varepsilon n of these buckets, and there are a total of 10εn10\varepsilon n buckets, the desired conclusion follows immediately. ∎

B.2 Proof of Lemma 3.1

Before we prove this lemma, we require the following matrix Chernoff bound:

Let M1,…,Mn∈Rd×dM_{1},\ldots,M_{n}\in\R^{d\times d} be a sequence of independent, random, PSD matrices. Assume that ∥Mi∥2≤L\lVert M_{i}\rVert_{2}\leq L for all i=1,…,ni=1,\ldots,n, and suppose ∥\E[∑i=1nMi]∥2≤n\left\lVert\E\left[\sum_{i=1}^{n}M_{i}\right]\right\rVert_{2}\leq n. Then, there is some universal constant c≤2log⁡2−1c\leq 2\log 2-1 so that for all t≥2t\geq 2, we have

Let EE be the event E={X:∥X−μ∥2<dcε}E=\left\{X:\left\lVert X-\mu\right\rVert_{2}<\sqrt{\frac{d}{c\varepsilon}}\right\}, and let S={Xi:Xi∈E}S=\left\{X_{i}:X_{i}\in E\right\}. We claim this set satisfies the properties claimed.

In particular, we let c=e−2c=e^{-2}, by simplifying we obtain that Pr⁡[∣S∣<(1−ε)n]<exp⁡(−εn)\Pr\left[|S|<(1-\varepsilon)n\right]<\exp(-\varepsilon n). Let E1E_{1} be the event that ∣S∣≥(1−ε)n|S|\geq(1-\varepsilon)n.

by Markov’s inequality, we have Pr⁡[E1]≥1−δ/2\Pr[E_{1}]\geq 1-\delta/2. We additionally have that for any unit vector vv,

where the third line follows from Cauchy-Schwartz, the last line follows from (48), and since Σ⪯\Id\Sigma\preceq\Id. Taking a supremum over all unit vectors vv yields that ∥μ′∥2≤cε\left\lVert\mu^{\prime}\right\rVert_{2}\leq\sqrt{c\varepsilon}. Therefore, conditioned on both E1E_{1} and E2E_{2}, we have

We now turn our attention to the claimed bound on the covariance. Let YiY_{i} be as above. Then, by assumption we have ∥YiYi⊤∥2=∥Yi∥22≤dcε\left\lVert Y_{i}Y_{i}^{\top}\right\rVert_{2}=\left\lVert Y_{i}\right\rVert_{2}^{2}\leq\frac{d}{c\varepsilon}, and moreover we have

for some universal constant c′>0c^{\prime}>0. Let E3E_{3} be the event that (50) holds. Then, conditioned on both E1E_{1} and E3E_{3} holding, we have

as claimed, where (a) follows since centering the second moment matrix can only decrease its top eigenvalue. Thus, (49) and (51) imply that, conditioned on events E1,E2,E3E_{1},E_{2},E_{3} simultaneously, the set SS is (γ1,γ2)(\gamma_{1},\gamma_{2})-good with respect to DD. By a union bound, these three events happen simultaneously with probability at least 1−δ−exp⁡(−εn)1-\delta-\exp(-\varepsilon n), as claimed. ∎

Appendix C Omitted proofs from Section 4

The two concentration bounds in (16) are standard (see e.g. ). Thus in this section, we focus on proving the concentration bounds corresponding to the bounds in (17). Since the two proofs are very similar, we will only prove the bound on β2\beta_{2}; the bound on β1\beta_{1} will follow almost identically by substituting the appropriate Chernoff bound.

Let X1,…,XnX_{1},\ldots,X_{n} be i.i.d. from an isotropic subgaussian distribution over Rd\R^{d} with variance proxy 11. Without loss of generality assume that the mean of the distribution is 00. It follows from the Hanson-Wright inequality and a standard net argument (see e.g. Lemma 2.1.7 in ) that there exist universal constants A,B>0A,B>0 so that for all t≥0t\geq 0, we have:

In particular, applying this bound to any fixed S⊂[n]S\subset[n] with ∣S∣=2εn|S|=2\varepsilon n yields that

for a different choice of universal constant BB. Hence, by a union bound over all SS of size 2εn2\varepsilon n, we obtain that

where H(α)H(\alpha) is the binary entropy of α\alpha. For ε≤1/4\varepsilon\leq 1/4, there exists a universal constant CC so that H(2ε)≤Cεlog⁡1/εH(2\varepsilon)\leq C\varepsilon\log 1/\varepsilon. Plugging this in, and by our definition of β2\beta_{2}, we obtain that

as claimed. To obtain the corresponding bound for β1\beta_{1}, simply use a Chernoff style bound (e.g. Lemma 2.1.6 in ) instead of (53). ∎