New Frameworks for Offline and Streaming Coreset Constructions

Vladimir Braverman, Dan Feldman, Harry Lang, Adiel Statman, Samson Zhou

Introduction

Coresets are an important technique in machine learning, data sciences, and statistics for representing a large dataset with a much smaller amount of memory. Coresets are often used as a pre-processing dimensionality technique to improve the downstream efficiency of algorithms, both space and time. Informally speaking, a coreset SS of an input set PP of underlying points p1,…,pnp_{1},\ldots,p_{n} is a smaller number of weighted representatives of PP that can be used to approximate the cost of any query from a set of a given queries. For example, in the common kk-means clustering problem, the coreset must approximate ∑i=1nd(pi,C)2\sum_{i=1}^{n}d(p_{i},C)^{2} for every query CC, where CC is a set of kk points and d(pi,C)d(p_{i},C) is taken to be the smallest Euclidean distance from pip_{i} to any point in CC. Thus to use a coreset SS to approximately solve the kk-means clustering problem, it suffices to find the optimal clustering on SS rather than find the optimal clustering on PP. Because the size of SS is much smaller than the size of PP, i.e., ∣S∣≪∣P∣|S|\ll|P|, then finding an optimal clustering on SS instead of PP will be much more efficient.

More generally, coreset is a set of points P′P^{\prime} with corresponding weight function w(⋅)w(\cdot) such that ∑pi′∈P′w(p′)d(pi′,C)2\sum_{p^{\prime}_{i}\in P^{\prime}}w(p^{\prime})d(p^{\prime}_{i},C)^{2} is a (1±ϵ)(1\pm\epsilon) approximation to ∑i=1nd(pi,C)2\sum_{i=1}^{n}d(p_{i},C)^{2}. Coresets have been extensively studied in kk-means clustering [BHI02, HM04, FS05, FS08, FL11, FS12, FSS13, BLUZ19, HV20, FSS20], subspace approximation [DRVW06, DV07, FL11, FMSW10a, FSS13, CW15, SW18], and a number of other geometric problems and applications [AHY06, FFS06, Cla08, DDH+08, AB09, PT18, HJLW18, ABB+19, MSSW18, BDM+18, MOB+20], due to the increasing availability of big data and the necessity for scalable methods to process this information.

The most common algorithmic procedure to designing a coreset is the following simple template. An algorithm first approximately evaluates the sensitivity of each point in the dataset. Informally, the sensitivity of a point quantities how important or distinct that point is, with respect to the given objective function on which we would like to optimize. Approximating the sensitivity of each point can often be done efficiently, so that the time to construct a coreset is often a lower order term compared to the runtime of the post-processing algorithm. The template then samples a fixed number of points, so that each point in the dataset with probability proportional to the sensitivity of the point. This approach is called sensitivity sampling and the fixed number of points is often a monotonically increasing function of the total sensitivity, defined to be the sum of the sensitivities of each point. Hence, if the numbered of sampled points is much smaller than the number of input points, this approach allows for compact dimensionality reduction, leading to improved performance of post-processing algorithms.

Since the total sensitivity is a central quantity to coreset techniques, the total sensitivity for various objective functions has been well-studied and completely characterized in some cases. However, it is not quite known what the optimal dependency between the total sensitivity and the size of the coreset should be; that is, what is optimal monotonically increasing function of the total sensitivity that governs the number of sampled points? Clearly smaller functions lead to smaller coresets, which lead to more efficient post-processing functions. Many recent coreset constructions in the past decade require constructing coresets whose size depends quadratically on the total sensitivity. In this paper, we show this dependency is not optimal; we introduce in Theorem 1.1 a generic construction whose dependency on the total sensitivity tt is only O(tlog⁡t)O(t\log t) rather than O(t2)O(t^{2}) [FL11]. Because the dependency is already black-boxed into the design of many coreset constructions, our results automatically improve many existing coreset algorithms simply by lowering the number of required samples, without modifying any other property of the algorithm; we are only showing that the worst-case theoretical guarantee of these algorithms is significantly and universally better than previously thought.

We show that the common sensitivity sampling framework only needs to sample O(tlog⁡t)O(t\log t) points, where tt is the total sensitivity.

Let dd be the dimension of a query space (P,w,Q,f)(P,w,Q,f). For each point pp, let m(p)m(p) be an upper bound on the sensitivity of point pp. Let t(p)=∑p∈Pm(p)t(p)=\sum_{p\in P}m(p), and ε,δ∈(0,1)\varepsilon,\delta\in(0,1). Then by sampling O(tε2(dlog⁡t+log⁡(1δ)))O\left(\frac{t}{\varepsilon^{2}}\left(d\log t+\log\left(\frac{1}{\delta}\right)\right)\right) i.i.d. points from PP and rescaling each sampled point by 1m(p)\frac{1}{m(p)}, the resulting sample is an ϵ\epsilon-coreset for PP.

In contrast, previous analysis showed that the sensitivity sampling framework required O(t2)O(t^{2}) points [FL11]. We emphasize that our results are purely theoretical; we show that any worst-case guarantee that could previously be achieved with O(t2)O(t^{2}) samples can actually be achieved with only O(tlog⁡t)O(t\log t) samples. Hence our results can be universally plugged into any existing coreset construction algorithm simply by requiring a lower number of samples. Moreover, our results are optimal, since it can be shown by standard coupon-collector arguments that Ω(tlog⁡t)\Omega(t\log t) samples are necessary in some cases.

We show that the results of [LLS01] also succeed if the VC-dimension of F\mathcal{F} is dd, rather than the pseudo-dimension. This implies that the algorithm outputs a (p,ϵ)(p,\epsilon)-approximation of all functions in F\mathcal{F}, which means if the function is too small, then the resulting data structure can only provide an additive error guarantee rather than a multiplicative relative error guarantee, but if the function is adequately large, then the resulting data structure provides a multiplicative error guarantee.

Fortunately, we show this guarantee suffices to obtain an ε\varepsilon-coreset. We break the query space into partitions, based on how much a point contributes to a query, compared to the total contribution to a query across all the points. If the contribution of a partition is large, then our (p,ϵ)(p,\epsilon)-approximation guarantees a good approximation to this partition. Now if the contribution of a partition is small, then two things can happen. Either it is possible that the sum of the contributions of all of the “small” partitions is large, in which case our (p,ϵ)(p,\epsilon)-approximation again guarantees a good approximation, or the sum of the contributions remains insignificant. In this case, we only have an additive approximation of the contributions for these points, but because the sum of the contributions is insignificant, an additive error on these points translates to a small relative error on the entire objective function.

Theorem 1.1 has applications to many problems in machine learning. In Section 3, we describe applications to model fitting problems. Specifically, we consider the (j,k)(j,k)-projective clustering problems such as kk-median/kk-means, kk-line clustering, jj-subspace approximation, and the integer (j,k)(j,k)-projective clustering problem.

Informally, the goal is to find a model FF in a restricted family F\mathcal{F} of set of kk-tuples of affine jj-subspaces that minimizes ∑p∈Pd(p,F)\sum_{p\in P}d(p,F), where PP is a set of input points. Here, FF is the union of kk jj-flats so that if j=0j=0, then each jj-flat reduces to a point and the (j,k)(j,k)-projective clustering problem becomes the kk-median problem with the appropriate metric. On the other hand, with an alternate distance function (the squared Euclidean distance), d(⋅,⋅)d(\cdot,\cdot), the (j,k)(j,k)-projective clustering objective becomes the kk-means problem. When j=1j=1 and kk is fixed, the objective becomes the kk-line clustering problem but if jj is fixed and k=1k=1, then the objective instead becomes the subspace approximation problem. Finally, in the integer (j,k)(j,k)-projective clustering problem, all points in PP are assumed to have integer coordinates from some predetermined range. Our results subsume earlier versions online that have not received independent verification and are summarized in Figure 1.

Although our primary contribution is theoretical, we complement our worst-case guarantees with empirical evaluations on both small and large-scale datasets, which we describe in Section 5.

2 Preliminaries

Let XX be called a ground set. Let P⊆XP\subseteq X be a (possibly ordered) multi-set and w:P→[0,∞)w:P\to[0,\infty) be a function that maps every p∈Pp\in P to a weight w(p)≥0w(p)\geq 0. The pair (P,w)(P,w) is called a weighted set in XX. If w(p)=1w(p)=1 for every p∈Pp\in P then the (un)weighted set (P,w)(P,w) may be denoted by PP for short.

The order of the points in PP can be arbitrary in this paper. However, even if PP contains only a single copy of each point, the corresponding coreset may contain multiple instances of some points. Hence, we consider coresets as multi-sets, although duplicated points can usually be replaced by a single weighted point without changing the claimed results. The union and intersection are also implied to be over multi-sets in this paper.

Usually the loss function has specific properties such as being a pseudo distance function DD, as will be defined later. However, it may also be more complicated such as a subtraction between pseudo distance functions, which will also be used in this paper. This is also why it may return a negative number. In general, we will be interested in approximating ∑p∈Pw(p)f(p,q)\sum_{p\in P}w(p)f(p,q) for every query qq in the query space up to an additive error of ε\varepsilon.

For a set XX, a query function QQ, and a cost function ff, we define the VC-dimension of the range space that it induced, as defined below. The classic VC-dimension was defined for sets and subset and here we generalize it to query spaces, following [FL11].

The following definition of sensitivity is central to our paper, as we shall show that the coreset size of our algorithm is proportional to the total sensitivity of the input set.

Let (P,w,Q,f)(P,w,Q,f) be a query space over a ground set XX, where w:P→[0,∞)w:P\to[0,\infty) and f:P×Q(P)→[0,∞)f:P\times Q(P)\to[0,\infty). Then we define the sensitivity of a point p∈Pp\in P by s(p)=sup⁡C∈Qw(p)∣f(p,C)∣s(p)=\sup_{C\in Q}w(p)|f(p,C)|.

Then the total sensitivity of an input set is the natural definition:

Let (P,w,Q,f)(P,w,Q,f) be a query space over a ground set XX, where w:P→[0,∞)w:P\to[0,\infty) and f:P×Q(P)→[0,∞)f:P\times Q(P)\to[0,\infty). We define the total sensitivity of PP by ∑p∈Ps(p)\sum_{p\in P}s(p), where s(p)s(p) is the sensitivity of pp.

We next define two related concepts, the (ν,α)(\nu,\alpha)-samples and relative (p,ε)(p,\varepsilon)-approximations.

[LLS01] Let α,ν>0\alpha,\nu>0. For every a,b≥0a,b\geq 0, we define the distance function dν(a,b)=∣a−b∣a+b+νd_{\nu}(a,b)=\frac{|a-b|}{a+b+\nu}. Let (P,w,Q,f)(P,w,Q,f) be a query space over a ground set XX, where w:P→[0,∞)w:P\to[0,\infty) and f:P×Q(P)→[0,∞)f:P\times Q(P)\to[0,\infty). Then the weighted set (S,u)(S,u) is called a (ν,α)(\nu,\alpha)-sample for (P,w,Q,f)(P,w,Q,f) if (S,u,Q,f)(S,u,Q,f) is a query space, and for every q⊆Q(S)q\subseteq Q(S), dν(f‾(P,w,;q),f‾(S,u,q))≤αd_{\nu}(\overline{f}(P,w,;q),\overline{f}(S,u,q))\leq\alpha, where f‾(P,w,q)=∑p∈P∣w(p)⋅f(p,q)∣∑p∈Pw(p)\overline{f}(P,w,q)=\frac{\sum_{p\in P}|w(p)\cdot f(p,q)|}{\sum_{p\in P}w(p)}.

[HS11] Let 0<p,ε<10<p,\varepsilon<1. Let (P,w,Q,f)(P,w,Q,f) be a query space over a ground set XX, where w:P→[0,∞)w:P\to[0,\infty) and f:P×Q(P)→[0,∞)f:P\times Q(P)\to[0,\infty). Then the weighted set (S,u)(S,u) is called a (ν,α)(\nu,\alpha)-sample for (P,w,Q,f)(P,w,Q,f) if (S,u,Q,f)(S,u,Q,f) is a query space, and for every q⊆Q(S)q\subseteq Q(S),

(1−ε)f‾(P,w,q)≤f‾(S,u,q)≤(1+ε)f‾(P,w,q)(1-\varepsilon)\overline{f}(P,w,q)\leq\overline{f}(S,u,q)\leq(1+\varepsilon)\overline{f}(P,w,q), for f‾(P,w,q)≥p\overline{f}(P,w,q)\geq p

f‾(P,w,q)−εp≤f‾(S,u,q)≤f‾(P,w,q)+εp\overline{f}(P,w,q)-\varepsilon p\leq\overline{f}(S,u,q)\leq\overline{f}(P,w,q)+\varepsilon p, for f‾(P,w,q)≤p\overline{f}(P,w,q)\leq p,

where f‾(P,w,q):=∑p∈P∣w(p)⋅f(p,q)∣∑p∈Pw(p)\overline{f}(P,w,q):=\frac{\sum_{p\in P}|w(p)\cdot f(p,q)|}{\sum_{p\in P}w(p)}.

We recall the equivalence between (ν,α)(\nu,\alpha)-samples and relative (p,ε)(p,\varepsilon)-approximations:

[HS11] Let (X,R)(X,\mathcal{R}) be a range space. If (Z,R)(Z,\mathcal{R}) is a (ν,α)(\nu,\alpha)-sample for (X,R)(X,\mathcal{R}) with 0<α<140<\alpha<\frac{1}{4} and ν>0\nu>0, then ZZ is a relative (ν,4α)(\nu,4\alpha)-approximation for (X,R)(X,\mathcal{R}).

Let P′=(P,w)P^{\prime}=(P,w) be a weighted set in XX, and ε>0\varepsilon>0 be an approximation error. The weighted set C′=(C,u)C^{\prime}=(C,u) in XX is an ε\varepsilon-coreset for a query space (P′,Q,f)(P^{\prime},Q,f) if for every q∈Q(C)q\in Q(C) we have (1−ε)∑p∈Cu(p)f(p,q)≤∑p∈Pw(p)f(p,q)≤(1+ε)∑p∈Cu(p)f(p,q)(1-\varepsilon)\sum_{p\in C}u(p)f(p,q)\leq\sum_{p\in P}w(p)f(p,q)\\ \leq(1+\varepsilon)\sum_{p\in C}u(p)f(p,q).

Sensitivity Sampling

In this section, we show that provable worst-case guarantees for constant factor approximation can be achieved using the sensitivity sampling framework to construct coresets of size O(tlog⁡t)O(t\log t), where tt is the total sensitivityWe also achieve optimal dependence on 1ϵ\frac{1}{\epsilon} for a (1+ϵ)(1+\epsilon)-approximation, but we omit these factors for ease of discussion. This improves on previous analysis that the sensitivity sampling framework to sample O(t2)O(t^{2}) points to construct coresets that guaranteed constant factor approximation [FL11]. We remark that our result is purely theoretical and does not require novel algorithmic implementation. Instead, our result shows that the parameters in existing coreset construction algorithms can be improved while still guaranteeing worst-case performance.

Recall that the sensitivity of a point p∈Pp\in P is defined by s(p)=sup⁡C∈Q(P)w(p)∣f(p,C)∣s(p)=\sup_{C\in Q(P)}w(p)|f(p,C)|, where w:P→[0,∞)w:P\to[0,\infty) is a weight function pp and f:P×Q(P)→[0,∞)f:P\times Q(P)\to[0,\infty) is a loss function between an input point and a query set. However, determining the exact sensitivity of a point can be time-consuming, so we instead define m(p)≥s(p)m(p)\geq s(p) to be an upper bound on the sensitivity. It turns out that upper bounds m(p)m(p) that are within a constant factor approximation of the exact sensitivity of a point are often efficiently computable. Then t:=t(P)=∑p∈Pm(p)t:=t(P)=\sum_{p\in P}m(p) is an upper bound on the total sensitivity, which is the sum of the sensitivities of all points in PP.

We now formalize the sensitivity sampling framework broadly used in algorithmic design. We form a sample SS by picking the first point of SS to be p∈Pp\in P with probability m(p)t(P)\frac{m(p)}{t(P)} and reweighting the sampled point with the inverse of the sampling probability. We show that repeatedly sampling points from PP with replacement until SS has ctε2(dlog⁡t+log⁡(1δ))\frac{ct}{\varepsilon^{2}}\left(d\log t+\log\left(\frac{1}{\delta}\right)\right) points suffices to obtain an ε\varepsilon-coreset for PP with probability 1−δ1-\delta if the underlying query space has VC dimension dd. The sensitivity sampling framework appears in full in Algorithm 1.

We first recall the following definition of pseudo-dimension:

[LLS01] show that if F\mathcal{F} has pseudo-dimension dd, then O(1α2νlog⁡1ν)O\left(\frac{1}{\alpha^{2}\nu}\log\frac{1}{\nu}\right) samples suffices to simultaneously obtain an (ν,α)(\nu,\alpha)-sample to expectation of all functions in F\mathcal{F} with constant probability. Namely, [LLS01] show the following two lemmas:

Let F\mathcal{F} be a set of functions from XX to $,,\mubeaprobabilitydistributionoverbe a probability distribution overXandand\nu>0,,0<\alpha<1,and, andN\geq\frac{2}{\alpha^{2}\nu}.Foranyinteger. For any integerN>0,let, let\Gamma_{N}denotethesetofallpermutationsofdenote the set of all permutations of\{1,\ldots,2N\}sothatforeachso that for eachi\leq N,either, eitheriandandN+iarefixed,orare fixed, oriandandN+iareswapped.Letare swapped. LetUbetheuniformdistributionoverbe the uniform distribution over\Gamma_{m}$. Then

Let dd be the pseudo-dimension of F⊆2NF\subseteq^{2N}, where N≥125(2d+1)α2νN\geq\frac{125(2d+1)}{\alpha^{2}\nu} for any α,ν>0\alpha,\nu>0. Let UU be the uniform distribution over ΓN\Gamma_{N}. Then

Observe that combining Lemma 2.2 and Lemma 2.3 and solving for NN recovers the bound from [LLS01] of O(1α2ν(dlog⁡1ν+log⁡1δ))O\left(\frac{1}{\alpha^{2}\nu}\left(d\log\frac{1}{\nu}+\log\frac{1}{\delta}\right)\right). We need an analog of their sampling result for VC-dimension rather than pseudo-dimension. As it turns out, the only place [LLS01] uses pseudo-dimension in Lemma 2.3 is a black-box reduction from the following lemma to bound the size of F\mathcal{F}:

Moreover, [Hau95] proved the exact same statement when dd is the VC-dimension of FF, rather than the pseudo-dimension.

Specifically, Lemma 2.5 follows from Corollary 1 in [Hau95] because e(d+1)(2e/ε)d≤(2e3/ε)d<(41/ε)de(d+1)(2e/\varepsilon)^{d}\leq(2e^{3}/\varepsilon)^{d}<(41/\varepsilon)^{d}.

Thus by using Lemma 2.5 rather than Lemma 2.4, we can recover Lemma 2.3 using VC-dimension rather than pseudo-dimension in the following formulation of Theorem 2.6. Hence, we can relate the sampling complexity of learning a class of functions to their VC-dimension:

2 Reduction to ε𝜀\varepsilon-Coresets

We now show that an (ν,α)(\nu,\alpha)-sample to a class of functions F\mathcal{F} suffices to achieve an ε\varepsilon-coreset under the appropriate parameters. The proof partitions the points in an input set PP by their contribution to ∑p∈Pw(p)f(p,X)\sum_{p\in P}w(p)f(p,X) for some XX in the query space. A subset SiS_{i} that contributes a large fraction towards ∑p∈Pw(p)f(p,X)\sum_{p\in P}w(p)f(p,X) will be well-estimated by the (ν,α)(\nu,\alpha)-sample. On the other hand, if SiS_{i} is not well-estimated by the (ν,α)(\nu,\alpha)-sample, then its contribution towards ∑p∈Pw(p)f(p,X)\sum_{p\in P}w(p)f(p,X) must be small, so that intuitively, the additive error from the (ν,α)(\nu,\alpha)-sample is also small. Thus we can show that the sample is actually an ε\varepsilon-coreset.

Let dd be the dimension of a query space (P,w,Q,f)(P,w,Q,f). Suppose that m:P→[0,∞)m:P\to[0,\infty) such that m(p)≥sup⁡C∈Q(P)w(p)∣f(p,C)∣m(p)\geq\sup_{C\in Q(P)}w(p)|f(p,C)|. Let t≥∑p∈Pm(p)t\geq\sum_{p\in P}m(p), and ε,δ∈(0,1)\varepsilon,\delta\in(0,1). Let c≥1c\geq 1 be a sufficiently large constant, and let SS be a sample of

Since ZZ is (1t,ε)\left(\frac{1}{t},\varepsilon\right)-approximation for (X,R)(X,\mathcal{R}) and A2A_{2} only consists of indices ii such that SiS_{i} contributes at least 1t\frac{1}{t} fraction of the mass, then

Now if ∑i=∈A1μi≥1t\sum_{i=\in A_{1}}\mu_{i}\geq\frac{1}{t}, then since ZZ is a (1t,ε)\left(\frac{1}{t},\varepsilon\right)-approximation for (X,R)(X,\mathcal{R}), then

Hence combining with (1) and noting that P=P1∪P2P=P_{1}\cup P_{2}, then we have

On the other hand, if ∑i=∈A1μi<1t\sum_{i=\in A_{1}}\mu_{i}<\frac{1}{t}, then since ZZ is a (1t,ε)\left(\frac{1}{t},\varepsilon\right)-approximation for (X,R)(X,\mathcal{R}), it follows that

Since we have t∑p∈Pm(p)≥∑p∈Ps(p)=∑p∈Psup⁡C∈Q(P)w(p)∣f(p,C)∣≥0t\sum_{p\in P}m(p)\geq\sum_{p\in P}s(p)=\sum_{p\in P}\sup_{C\in Q(P)}w(p)|f(p,C)|\geq 0, then εt≤ε∑p∈Ps(p)\frac{\varepsilon}{t}\leq\frac{\varepsilon}{\sum_{p\in P}s(p)} and thus

Moreover, ∑i=∈A1μi<1t\sum_{i=\in A_{1}}\mu_{i}<\frac{1}{t} implies that ∑p∈Siw(p)f(p,X)∑p∈Ps(p)<εt≤ε∑p∈Ps(p)\frac{\sum_{p\in S_{i}}w(p)f(p,X)}{\sum_{p\in P}s(p)}<\frac{\varepsilon}{t}\leq\frac{\varepsilon}{\sum_{p\in P}s(p)}. Therefore, we have ∑p∈Siw(p)f(p,X)<1\sum_{p\in S_{i}}w(p)f(p,X)<1, so that

Again combining with (1) and noting that P=P1∪P2P=P_{1}\cup P_{2}, then

Note that P2P_{2} contains at most log⁡t\log t sets SiS_{i}, it suffices to obtain (1t,ε)\left(\frac{1}{t},\varepsilon\right)-sample for O(log⁡t)O(\log t) sets, each with failure probability Θ(δlog⁡t)\Theta\left(\frac{\delta}{\log t}\right), using Theorem 2.6. By a union bound, the total failure probability is at most δ\delta. □\Box

The intuition is that the class of functions F\mathcal{F} represents the objective in the query space, so that a particular f∈Ff\in\mathcal{F} represents the objective for a particular query in the query space. For objectives like kk-means or kk-median clustering, each ff represents the objective for a separate set of kk centers. Then the goal is to learn F\mathcal{F} simultaneously with a small number of samples.

The domain XX for the class of functions F\mathcal{F} translates exactly to the ground set XX, which is the input points for objectives like kk-means or kk-medians. We first note that sampling a point of XX and then rescaling by the (inverse of the) sampling probability provides an unbiased estimator to the objective. [LLS01] then states that if we sample uniformly over XX, we can obtain a (1+ε)(1+\varepsilon)-approximation to the objective by bounding the variance through a small number of samples. Then the idea of sensitivity sampling is that instead of uniformly sampling points from XX, we sample each point of XX according to its sensitivity, but still rescale by the (inverse of the) sampling probability. Now the expectation of the samples is still the objective, but the variance is much smaller and so we require a smaller number of samples.

The real workhorse in this bound is Lemma 2.2 by [LLS01], which uses the chaining technique of Kolmogorov and refined by Talagrand [Tal94]. Crucially, the usage of chaining by [LLS01] manages to simultaneously learn a large number of functions in a class F\mathcal{F} without needing to union bound over a net over the functions in F\mathcal{F}. It is precisely this technique that avoids a quadratic dependency on tt from the union bound.

Applications

Our theoretical worst-case guarantee has a wide range of applications due to the prevalence of the coreset technique and how well-studied the total sensitivity is of various optimization problems. Note that for any problem whose sensitivity is known to be tt, Theorem 1.1 gives an improvement on dependency of tt from O(t2)O(t^{2}) to O(tlog⁡t)O(t\log t) for the number of sampled points. [VX12b] considers sensitivity sampling for shape fitting problems, focusing on (j,k)(j,k)-projective clustering problems, such as kk-median/kk-means, kk-line clustering, jj-subspace approximation, and the integer (j,k)(j,k)-projective clustering problem. We show that our results imply more efficient coreset constructions using the total sensitivity bounds on these problems obtained by [VX12b].

For the kk-line center problem and the integer general (j,k(j,k)-projective clustering problem, [VX12a] showed the following upper bounds on the total sensitivity:

Then Theorem 3.2 and Theorem 1.1 together imply efficient coresets for both the kk-line center problem and the integer (j,k)(j,k)-projective clustering problem.

We remark that Theorem 3.4 is subsumed by Theorem 3.6 below, as [VX12b] tighten the total sensitivity upper bound for the kk-line center problem by showing that f(d,k)f(d,k) in Theorem 3.2 is independent of dd.

From Theorem 3.5 and Theorem 1.1, we have

[VX12b] bounded the total sensitivity for the (0,k(0,k)-projective clustering problem, which includes kk-median and kk-means.

For either the kk-median problem or the kk-means problem, there exists an algorithm that outputs a set of O(dε2klog⁡k)O\left(\frac{d}{\varepsilon^{2}}k\log k\right) weighted points that is an ϵ\epsilon-coreset, with probability at least 23\frac{2}{3}.

[VX12b] also bounded the total sensitivity for the jj-subspace fitting problem.

By Theorem 3.9 and Theorem 1.1, we conclude that

Coreset for k𝑘k-clustering

This section considers tighter bounds for kk-clustering and may be skipped for general applications. We introduce ρ\rho-pseudo distances and define the importance of a point as a generalization of the sensitivity. Using the importance, we then give an analog of Theorem 1.1 with sharper bounds for ρ\rho-pseudo distances. As a result, we obtain stronger bounds for coreset constructions for kk-clustering.

We reiterate that our results in this section mirror those of Section 2. We only provide theoretical guarantees on the number of samples required by the sensitivity sampling framework for kk-clustering. We specify the framework in full in Algorithm 2.

We first require the following definition of (α,β)(\alpha,\beta)-assignment for bicriteria algorithms.

Let XX be a ground set and (P,w,Q,g)(P,w,Q,g) be a query space where g:X2→[0,∞)g:X^{2}\to[0,\infty). Let Q∗∈Q(P)Q^{*}\in Q(P) be a query that minimizes the loss of PP over every query,

Let α,β>0\alpha,\beta>0, and B⊆XB\subseteq X such that ∣B∣≤β∣Q∗∣|B|\leq\beta|Q^{*}|. A function B:P→B\mathcal{B}:P\to B is an (α,β)(\alpha,\beta)-assignment for (P,w,Q,g)(P,w,Q,g) if

Every b∈Bb\in B is called a center and its cluster in PP is B−1(b)={p∈P∣B(p)=b}\mathcal{B}^{-1}(b)=\left\{p\in P\mid\mathcal{B}(p)=b\right\}.

Intuitively, an (α,β)(\alpha,\beta)-assignment is just a bicriteria clustering with approximation factor α\alpha and an overselection of centers by a factor of β\beta. Thus for kk-means clustering, any α\alpha-approximation algorithm that chooses βk\beta k centers can be used to determine an (α,β)(\alpha,\beta)-assignment for each of the points.

The following definition is especially useful for kk-means clustering.

Let XX be a ground set and ρ≥1\rho\geq 1. A symmetric function g:X2→[0,∞)g:X^{2}\to[0,\infty) is ρ\rho-pseudo distance over XX if for every (p,q,x)∈X3(p,q,x)\in X^{3}

For a finite set Q⊆XQ\subseteq X, we denote g(p,Q):=min⁡x∈Qg(p,x)g(p,Q):=\min_{x\in Q}g(p,x).

Note that the above definition does not assume that g(p,p)=0g(p,p)=0 for every p∈Pp\in P. The inequality in Definition 4.2 is sometimes called “weak triangle inequality”.

Let gg be a ρ\rho-pseudo distance over a ground set XX. For every pair of points p,q∈Xp,q\in X and a finite set Q⊆XQ\subseteq X,

Proof : For every p,q∈Xp,q\in X, and a center xp∈Qx_{p}\in Q that is closest to pp, i.e. g(p,Q)=g(p,xp)g(p,Q)=g(p,x_{p}), we have

We now give a generalization of the notion of sensitivity in the form of importance.

Let (P,w,Q,g)(P,w,Q,g) be a query space where w:P→[0,∞)w:P\to[0,\infty) and gg is a ρ\rho-pseudo distance. Let B:P→B\mathcal{B}:P\to B be an (α,β)(\alpha,\beta)-assignment for (P,w,Q,g)(P,w,Q,g). For every p∈Pp\in P and Q∈Q(P)Q\in Q(P), we define

For every center b∈Bb\in B and a point p∈B−1(b)p\in\mathcal{B}^{-1}(b) in its cluster we define

We now show that the importance mm satisfies a similar function as the notion of sensitivity.

Let B:P→B\mathcal{B}:P\to B, mm and ff be defined as in Definition 4.4. Then for every p∈Pp\in P we have

Proof : For simplicity, we denote p′=B(p)p^{\prime}=\mathcal{B}(p) and q′=B(q)q^{\prime}=\mathcal{B}(q) for every p,q∈Pp,q\in P, and Pb=B−1(p)P_{b}=\mathcal{B}^{-1}(p) for every b∈Bb\in B. We prove the claim for a point p∈Pbp\in P_{b} in the cluster of some center b∈Bb\in B, as in Definition 4.4. Let Q∈Q(P)Q\in Q(P) and assume w(p)f(p,Q)>0w(p)f(p,Q)>0, otherwise the lemma trivially holds. We need to upper bound

where the first inequality holds by Lemma 4.3, and the second inequality holds since B\mathcal{B} is an (α,β)(\alpha,\beta)-assignment. To bound the last term, note that

where the first inequality is by Lemma 4.3, (4) holds since p′=bp^{\prime}=b and since gg is symmetric by definition, and (5) holds since B\mathcal{B} is an (α,β)(\alpha,\beta)-assignment.

Dividing by ∑q∈Pbw(q)⋅∑q∈Pw(q)g(q,Q)\sum_{q\in P_{b}}w(q)\cdot\sum_{q\in P}w(q)g(q,Q) yields

Substituting this in (3) yields the desired result

As a warm-up, we now prove an analog of Theorem 1.1 for ρ\rho-pseudo distances that provides tighter bounds, due to the tighter setting of tt from the (α,β)(\alpha,\beta) assignment.

(P,w,Q,g)(P,w,Q,g) be a query space, where gg is a ρ\rho-pseudo distance and w:P→[0,∞)w:P\to[0,\infty).

B:P→B\mathcal{B}:P\to B be an (α,β)(\alpha,\beta) assignment for (P,w,Q,g)(P,w,Q,g).

dd be the VC-dimension of (P,w,Q,f)(P,w,Q,f), where ff was defined in (2).

c≥1c\geq 1 be a sufficiently large constant, ε,δ∈(0,1)\varepsilon,\delta\in(0,1), and

(C,u)(C,u) be the output of a call to \textscCoreset(P,w,B,s)\textsc{Coreset}(P,w,\mathcal{B},s); see Algorithm 2.

Then, C⊆PC\subseteq P, u:C→[0,∞)u:C\to[0,\infty) and, with probability at least 1−δ1-\delta, (C,u)(C,u) is an ε\varepsilon-coreset of size ∣C∣=s|C|=s for (P,w,Q,g)(P,w,Q,g).

Proof : Let p∈Pp\in P. By Lemma 4.5, for every Q∈Q(P)Q\in Q(P)

The probability of choosing pp to be, say, the first point in CC, is

Using the last inequality and (6), we apply Theorem 2.7 to obtain that, with probability at least 1−δ1-\delta, we have that for all Q∈Q(C)Q\in Q(C),

implies that (C,u)(C,u) is an ε\varepsilon-coreset as desired. □\Box

In this section, we define a (ρ,ψ,ϕ)(\rho,\psi,\phi)-pseudo distance function, which serves as a generalization of ρ\rho-pseudo distances, and give smaller coreset constructions for (ρ,ψ,ϕ)(\rho,\psi,\phi)-pseudo distance functions. Our algorithms appear in Algorithm 3 and Algorithm 4.

We define the following generalization of distance to handle kk-clustering.

Let gg be a ρ\rho-pseudo distance over XX as in Definition 4.2. For ϕ>0\phi>0 and ψ≥0\psi\geq 0, gg is also a (ρ,ψ,ϕ)(\rho,\psi,\phi)-pseudo distance function if for every (p,q,x)∈X3(p,q,x)\in X^{3} we have

Intuitively, the ρ\rho-pseudo distance handles loss functions such as the squared Euclidean distance that do not satisfy the triangle inequality but rather a generalized version of the triangle inequality.

Let g:X2→[0,∞)g:X^{2}\to[0,\infty) be a (ρ,ψ,ϕ)(\rho,\psi,\phi)-pseudo distance function. Then for every finite set M⊆XM\subseteq X and p,q∈Mp,q\in M we have

where the first inequality is by the definition of g(p,Q)=min⁡x∈Qg(p,Q)g(p,Q)=\min_{x\in Q}g(p,Q), and the second inequality is by Definition 4.7.

where the last inequality is by the assumption of this case. Combining (7) and (8) yields that (in both cases)

Let (P,w,Q,g)(P,w,Q,g) be a query space where w:P→[0,∞)w:P\to[0,\infty), and g:X2→[0,∞)g:X^{2}\to[0,\infty) is a (ρ,ψ,ϕ)(\rho,\psi,\phi)-pseudo distance function. Let B:P→B\mathcal{B}:P\to B be an (α,β)(\alpha,\beta)-assignment for (P,w,Q,g)(P,w,Q,g). Let ε∈(0,1)\varepsilon\in(0,1) such that ψ<ε/(4ρ(α+1))\psi<\varepsilon/(4\rho(\alpha+1)), and

Consider the variables in Definition 4.9. Let

and dd be the VC-dimension of (P,w,Q,h)(P,w,Q,h). Let c′c^{\prime} be a sufficiently large constant,

and (C∪B,u)(C\cup B,u) be the output of a call to algorithm \textscSmaller−Coreset(P,w,B,s)\textsc{Smaller-Coreset}(P,w,\mathcal{B},s); see Algorithm 3. Then, C⊆PC\subseteq P, u:C→[0,∞)u:C\to[0,\infty), and with probability at least 1−δ1-\delta, we have that for all X∈Q(C)X\in Q(C),

Proof : Let Q∈Q(C)Q\in Q(C) and extend the function uu as defined in Algorithm 3 to be u(p)=0u(p)=0 for every p∈P∖Cp\in P\setminus C. Also define v(p)=w(p)−u(p)v(p)=w(p)-u(p) and p′=B(p)p^{\prime}=\mathcal{B}(p) for every p∈Pp\in P. The difference in the loss between taking the original points or its coreset C∪BC\cup B is

where (12) is by the triangle inequality, and (13) holds since

where the last equality is by the definition of uu in Line 3 of Algorithm 3.

By letting F=F(Q)F=F(Q) as defined in (10), (13) is bounded by ∣∑p∈Pv(p)(g(p,Q)−g(p′,Q))∣\left|\sum_{p\in P}v(p)(g(p,Q)-g(p^{\prime},Q))\right|, which equals

where the last inequality is by the triangle inequality. We now bound each of the last terms.

where (16) holds since B\mathcal{B} is an (α,β)(\alpha,\beta)-assignment, i.e.,

(17) is by Lemma 4.8, and (18) is by (10) and the assumption p∈P∖Fp\in P\setminus F.

t≥2t\geq 2, and for every constant c>0c>0 there is a sufficiently large constant c′c^{\prime} such that

Plugging these bound in Theorem 2.7 with ε/4\varepsilon/4, and the query space (P,w,Q,h)(P,w,Q,h) yields that, with probability at least 1−δ/21-\delta/2, we have that for all Q∈Q(C)Q\in Q(C),

Assume that the last equation indeed holds (which happens with probability at least 1−δ/21-\delta/2). By this and the definition of gg, for every Q∈Q(C)Q\in Q(C), (14) is bounded by

Bound on (15): Since ∣v(p)∣=∣w(p)−u(p)∣≤w(p)+u(p)|v(p)|=|w(p)-u(p)|\leq w(p)+u(p), and using the triangle inequality

where the first inequality is by Lemma 4.8, the second holds since p∈Fp\in F, and the last inequality is by (9).

Our (α,β)(\alpha,\beta)-assignment approximates the sum of distances to a query up to an additive error as follows.

where (23) is by Lemma 4.3, and (24) is by (19). Hence,

where (25) is by (21), (26) holds by (23), (27) holds by (22), and (28) holds since F⊆PF\subseteq P.

It is left to bound the rightmost term in (28). Let z:P×B→[0,∞)z:P\times B\to[0,\infty) such that for every b∈Bb\in B and p∈Pbp\in P_{b}

where (30) holds since P=⋃b∈BPbP=\bigcup_{b\in B}P_{b}, in (31) we simply multiplied and divided by ∑q∈Pbw(q)g(q′,Q)\sum_{q\in P_{b}}w(q)g(q^{\prime},Q), and (32) holds since p′=q′p^{\prime}=q^{\prime} for every p,q∈Pbp,q\in P_{b}.

where (33) holds since v(p)=w(p)−u(p)v(p)=w(p)-u(p), and (34) is by definition (29) of zz.

Let b∈Bb\in B, t′=2∣B∣t^{\prime}=2|B|, and for every p∈Pp\in P, let m(p)=w(p)z(p,b)m(p)=w(p)z(p,b). Hence, for every p∈Pp\in P,

and for every constant c≥1c\geq 1 there is a sufficiently large c′c^{\prime} such that

Substituting the query space (P,w,{b},z)(P,w,\left\{b\right\},z), ε=1/2\varepsilon=1/2, d=1d=1, and δ/∣B∣\delta/|B| instead of δ\delta in Theorem 2.7, yields that with probability at least 1−δ/(2∣B∣)1-\delta/(2|B|), we have

Assume the event that (35) holds for every b∈Bb\in B occurs, which happens with probability at least δ/2\delta/2, by the union boundInstead of using the union bound, we could simply choose BB as the set of queries, δ\delta instead of δ/(2∣B∣)\delta/(2|B|) and d=log⁡∣B∣d=\log|B|. However, in this would introduce a term of dlog⁡t=O(log⁡2∣B∣)d\log t=O(\log^{2}|B|) in the coreset size compared to the current log⁡∣B∣\log|B| term.. Plugging (35) in (34) yields

Combining the last inequalities bounds (15) with probability at least 1−δ/21-\delta/2, as

where (37) holds by (28), (38) by (30), and (39) by (36).

Finally, replacing (14) and (15) with (20) and (39) respectively, proves that, with probability at least 1−δ/2−δ/2=1−δ1-\delta/2-\delta/2=1-\delta we have

By this and (13), it follows that (C,u)(C,u) approximates XX as desired. □\Box

We now handle the specific case where g:X2→[0,∞)g:X^{2}\to[0,\infty) is a (ρ,ψ,ϕ)(\rho,\psi,\phi)-pseudo distance function.

Consider the variables in Theorem 4.10, where ss is replaced by

Let (C,u)(C,u) be the output of a call to algorithm \textscCoreset(P,w,B,s)\textsc{Coreset}(P,w,\mathcal{B},s); see Algorithm 3.

Then, C⊆PC\subseteq P, u:C→[0,∞)u:C\to[0,\infty), and with probability at least 1−δ1-\delta, (C,u)(C,u) is an ε\varepsilon-coreset of size ss for (P,w,Q,g)(P,w,Q,g).

Proof : Let ε′=ε/(1+ρ(α+1))\varepsilon^{\prime}=\varepsilon/(1+\rho(\alpha+1)). After replacing δ\delta with δ/2\delta/2 and ε\varepsilon with ε′\varepsilon^{\prime} in Theorem 4.10, we obtain that with probability at least 1−δ/21-\delta/2,

Assume that this event indeed occurs and the inequality holds, and let Q∈Q(C)Q\in Q(C).

We will bound the error by excluding BB from this coreset, i.e.,

where (41) is by the triangle inequality, and (42) is by (40). The rightmost term is

where (43) is by the definition of uu in Line 3 of Algorithm 3.

The bound on the rightmost term is similar to (35), after replacing the bound 1/21/2 with ε′\varepsilon^{\prime}, which is the reason for the largest size ss of the coreset. Specifically, let b∈Bb\in B, t′=2∣B∣t^{\prime}=2|B|, and for every p∈Pp\in P, let m(p)=w(p)z(p,b)m(p)=w(p)z(p,b), where zz is defined in (29). Hence, for every p∈Pp\in P,

and for every constant c≥1c\geq 1 there is a sufficiently large c′c^{\prime} such that

Substituting the query space (P,w,{b},z)(P,w,\left\{b\right\},z), d=1d=1, and δ/∣B∣\delta/|B| instead of δ\delta in Corollary 2.7, yields that with probability at least 1−δ/(2∣B∣)1-\delta/(2|B|), we have

Assume the event that (35) holds for every b∈Bb\in B indeed occurs, which happens with probability at least δ/2\delta/2. Substituting the value of z(p,b)z(p,b) from (35) and multiplying by ∑q∈Pbw(q)\sum_{q\in P_{b}}w(q) yields

where (46) is by (45), and (47) is by the property of (α,β)(\alpha,\beta)-assignment in (24).

Combining the previous inequalities all together yields the desired result

where (48) is by (42), and (49) is by (47).

Using the union bound on previous assumptions, this holds with probability at least 1−δ/2−δ/2=1−δ1-\delta/2-\delta/2=1-\delta. □\Box

2 Positively weighted coresets

In this section, we give a construction for a coreset that is guaranteed to output positive weights associated with each sampled point.

Consider the variables in Theorem 4.10. Let

and let (C∪B,u′)(C\cup B,u^{\prime}) be the output of a call to algorithm \textscConditional−Coreset(P,w,B,s,ε′)\textsc{Conditional-Coreset}(P,w,\mathcal{B},s,\varepsilon^{\prime}); see Algorithm 4. Then, C⊆PC\subseteq P, u:C×Q(C)→[0,∞)u:C\times Q(C)\to[0,\infty), and with probability at least 1−δ1-\delta, we have that for all X∈Q(C)X\in Q(C),

Proof : The proof is the same as the proof of Theorem 4.10 except for replacing u(p)u(p) with u′(p,Q)u^{\prime}(p,Q) everywhere, and replacing the bound on (25) by

where the first inequality is similar to (27), and the equality is since u′(p,Q)=0u^{\prime}(p,Q)=0 for every

Empirical Evaluations

This concludes our discussion of the general sensitivity sampling framework. Although our contribution is primarily theoretical, we nevertheless performed empirical evaluations in Python 3.6 via the Numpy and Scipy.sparse libraries on a desktop machine with an Intel i7-6850K CPU @ 3.60GHZ, 64GB RAM. We consider coreset constructions based on sensitivity sampling for bicriteria algorithms (Algorithm 1), general loss functions that satisfy the weak triangle inequality (Algorithm 2), and the conditional normalized distance (Algorithm 3). We compared Algorithms 1-3 to uniform sampling on kk-means clustering on both relatively small offline data and large-scale streaming data that cannot fit into memory. Algorithms 1-3 each require a bicriteria algorithm to approximate the importance of each point; we use kmeans++ with α=O(log⁡k)\alpha=O(\log k) and β=1\beta=1 to approximate the importances, so that the runtime is linear.

For experiments on small offline datasets, we compared our coreset constructions for kk-means clustering in Algorithms 1-3 vs. uniform sampling on the datasets: (i) Gyroscope data and (ii) Accelerometer data. Collected by [AGO+13b], and can be found on [AGO+13a], the experiments have been carried out with a group of 30 volunteers within an age bracket of 19-48 years. Each person performed six activities (walking, walking upstairs, walking downstairs, sitting, standing, laying) while wearing a Samsung Galaxy S II smartphone on the waist. Using its embedded gyroscope (resp. accelerometer), 3-axial angular velocity (resp. linear acceleration) were captured at a constant rate of 50Hz. The experiments have been video-recorded to label the data manually. Data was collected from n=7352n=7352 measurements; each instance consists of measurements from d=3d=3 dimensions: xx, yy, zz, each in a size of 128.

We ran Algorithms 1-3 and uniform sampling on the above six datasets with different sample/coreset size, between 1000 to 7000, with k=100k=100 and k=200k=200. The multiplicative approximation error (empirical ε\varepsilon) was calculated by ε:=COST(A,QC)−COST(A,QA)COST(A,QA)\varepsilon:=\frac{\text{\footnotesize{COST}}(A,Q_{C})-\text{\footnotesize{COST}}(A,Q_{A})}{\text{\footnotesize{COST}}(A,Q_{A})}, where AA is the matrix whose rows correspond to the nn input points, QAQ_{A} corresponds to the kk centers of the whole data (two Lloyd’s iterations after kmeans++ initialization) and QCQ_{C} is the clustering of the coreset. Our results show a significant improvement of our algorithms over uniform sampling; we present the gyroscope data evaluations in Figure 2 and the accelerometer data evaluations in Figure 3.

2 Evaluations on Streaming Data

To handle large-scale streaming data that cannot fit into memory, our system separates the nn points of the data into chunks of a desired size of coreset, called mm. We use a merge-and-reduce framework on a binary tree, e.g. [FMSW10b], where each node is a coreset of the union of the data represented by its children nodes and the bottom layer of the tree consists of consecutive chunks of the data of size 45164516. Thus the root of the tree is a coreset of the whole data. We build a tree of height 1010 for our data, dividing the n=4624611n=4624611 input points across 10241024 chunks of size 45164516.

We compared uniform sampling to Algorithms 1 and 3 for kk-means clustering on a created document-term matrix of Wikipedia (parsed enwiki-latest-pages-articles.xml.bz2-rss.xml from [wic19]), i.e. sparse matrix with 4624611 rows and 100k columns where each cell (i,j)(i,j) equals the value of how many appearances the word number jj has in article number ii. We use a standard dictionary of the 100k most common words in Wikipedia [Dic12]. We concatenated the coreset received in each floor and compared the received error in each floor. The error we determined was calculated by the formula COST(A,QC)−COST(A,QA)COST(A,QA)\frac{\text{\footnotesize{COST}}(A,Q_{C})-\text{\footnotesize{COST}}(A,Q_{A})}{\text{\footnotesize{COST}}(A,Q_{A})}, where AA is the original data matrix, QAQ_{A} is the clustering of the whole data (Lloyd’s iterations until 1% convergence, after ++ initialization) and QCQ_{C} is the clustering of the coreset. We used two values of kk, 100 and 200. We present our results in Figure 4. We concatenated the coreset received in each floor and compared the received error in each floor. The error we determined was calculated by the formula COST(A,QC)−COST(A,QA)COST(A,QA)\frac{\text{\footnotesize{COST}}(A,Q_{C})-\text{\footnotesize{COST}}(A,Q_{A})}{\text{\footnotesize{COST}}(A,Q_{A})}, where AA is the original data matrix, QAQ_{A} is the clustering of the whole data (Lloyd’s iterations until 1% convergence, after ++ initialization) and QCQ_{C} is the clustering of the coreset. We present our results in Figure 4 for k=100k=100 and k=200k=200. Similar to the offline evaluations, we obtain better results for our algorithms than uniform sampling. However, unlike than the offline data, here the conditional normalized algorithm gets much better results than the general sensitivity sampling algorithm.

Algorithms.

The algorithms we compared are uniform sampling, and our Algorithm 2 and 4.

Results.

We concatenated the coreset received in each floor and compared the received error in each floor. The error we determined was calculated by the formula COST(A,QA)−COST(A,QC)COST(A,QA)\frac{\text{\footnotesize{COST}}(A,Q_{A})-\text{\footnotesize{COST}}(A,Q_{C})}{\text{\footnotesize{COST}}(A,Q_{A})}, where AA is the original data matrix, QAQ_{A} is the clustering of the whole data (Lloyd’s iterations until 1% convergence, after ++ initialization) and QCQ_{C} is the clustering of the coreset. We used two values of kk, 100 and 200. We present our results in Figure 4.

Discussion.

Indeed also for this dataset we got better results for our algorithm than uniform sampling. However, unlike than in Section 5, here Algorithm 2 gets much better results than Algorithm 1.

References