Strong Coresets for k-Median and Subspace Approximation: Goodbye Dimension
Christian Sohler, David P. Woodruff
Introduction
Often in these problems one seeks a strong coreset, which means that with high probability, the data structure should work simultaneously for all queries . That is, one may use random choices in the construction of , but after forming it should be the case that can be used to provide a -relative error approximation for every possible query simultaneously. An advantage of such a coreset is that for any objective function for which a table of -approximate values to all possible queries can be used to provide a -approximation to the objective function, one can throw away the original set of points and instead just retain the data structure . For example, note that the above coreset for subspace approximation contains enough information to approximately solve principal component analysis (PCA), since if one finds the query -dimensional subspace with minimum approximate value, this provides a -dimensional subspace providing a -approximation to the space spanned by the top principal components. However, the above coreset for subspace approximation can also be used to solve the -means problem, since the latter can be rewritten as a constrained low rank approximation problem . Thus, given that a strong coreset approximately preserves the cost of any query, it can be used in place of the original point set in any application which depends only on the answers to the queries. Note that if the coreset were instead to only approximately preserve the cost of any fixed query with high probability, then it might not be possible to solve the problem using the coreset since one may need to adaptively query the data structure, and outputs to successive queries may no longer be correct since the inputs depend on outputs to previous queries.
Another advantage of a coreset is if it small, then it leads to considerable efficiency gains. For example, in distributed settings, each machine which has a subset of input points can compress its input points to a coreset, and then communicate the coreset to a central coordinator. The central coordinator, who often has more resources available, can then combine the coresets and use them to optimize the desired function. As communication is a bottleneck, a small coreset gives rise to more efficient protocols. Similarly, when processing a data stream, a common technique is the merge-and-reduce framework, in which one partitions the stream into chunks, computes a coreset on each chunk, and merges the coresets in a binary tree like structure as one processes successive chunks of the data stream. A small coreset thus leads to small space streaming algorithms.
A major open question was if one could obtain strong coresets independent of (and ) for -median and the subspace approximation problem with sum of distances , as opposed to the sum of squares of distances. Unlike the -means and sum of squares objective for subspace approximation, the -median and sum of distances measures are much less amenable to algebraic manipulation; indeed there is no singular value decomposition (SVD) which was the driving force behind previous results. Notably, this version of the subspace problem is NP-hard , unlike minimizing the sum of squares.
Now consider the cost of an arbitrary point at distance from the origin. The expected distance of an input point to this point is roughly and so the sum of distances will approach as . Now recall that the length of the projection of the input points goes to . Thus their distance to will be roughly . Thus, the sum of distances of the projected points is roughly plus the projection cost, which is roughly , and thus will give an estimate of , which is not a -approximation. Hence, we cannot simply work with a single additive weight as in the case of squared distances.
Next, since we can “move” each of the rows of to the corresponding rows in by paying a total sum of distances cost of , it follows by the triangle inequality that for any set of points that is contained in a -dimensional subspace , the sum of distances from the rows of to their corresponding closest points in is within of the sum of distances from the rows of to their corresponding closest points in .
Now we want to replace our original points (the rows of ) with their projections onto , namely, replace with . Although this step by itself does not reduce the number of points, each of the points after projection lives in a much lower dimensional subspace (rather than the initial space which has dimension ), and we will then be able to apply coreset construction techniques which depend on this much smaller dimension. For any set of points contained in a -dimensional subspace , by the Pythagorean theorem we can write the distance of a row of to as , where is the distance of to , and is the distance of the projection of onto , to . We instead try to approximate by , where is the distance of to and is the distance of the projection of onto , to . We observe in Lemma 4 that , and we know that the average values (over the points) of and are small by Lemma 6 combined with the triangle inequality.
Note that the value , which is different for each of the rows of , does not depend on or , whereas the value is exactly the distance of the row of to . If we were simply to define , then , where the i- row of contains the closest point (of the closure) of to the corresponding row of , would fail to capture the distances of the rows of to . Further, unlike for the norm, we cannot add a single number to account for this, which is a technique used in ; this is precisely the difficulty of the norm that we must deal with. Instead, a crucial idea is to append one additional coordinate to each row of , where in the -th row we append , where is the orthogonal projection onto . Then, to compute the distance to a -dimensional subspace , instead of approximating by , where the -th rows of and contain the closest points (of the closure) of to the corresponding row of and the first coordinates of the corresponding row of , respectively, we approximate by , where is the matrix which appends an all column to . Thus, the norm of the -th row of is , where is the distance of to , captured by the -st coordinate of , and is the distance of to . Thus, we have “encoded” the distances of the rows of to in the coreset this way. Note that this appended additional coordinate cannot be taken out of each row and combined into a single number, as in , because for each row, its square is added to the squared distance of a point to its projection onto , and then a square root is taken, so it occurs “under the square root” in the distance computations.
1.2 Coreset Construction for Subspace Approximation
1.3 Coreset Construction for kk-Median
To obtain a coreset for -median, we first apply our dimensionality reduction to get a matrix such that for every set of -centers we have , where and denote the matrices that contain in the -th row the closest center of to the -th row of and , respectively. We note that can be viewed as a point set in dimensions. We can then use an arbitrary coreset construction for this low dimensional point set where we append arbitrary dimensions to the space. Thus, the effect of the construction will be to replace the in a coreset construction by . We claim that a coreset for this enlarged space is also a coreset for the -dimensional space. The reason is that any set of -centers in the -dimensional space is either in the span of (in which case the coreset guarantee holds) or there is an orthogonal transformation that does not change and maps the remaining centers to the added dimensions. This implies that the coreset property holds for the full space. Thus, the cost of the coreset approximates the cost of upto a factor of . Combining this with the error bound of gives that the resulting set will be a coreset and the result follows by rescaling by a constant. Notice that the guarantee the coreset provides is slightly stronger than what we need as our centers will always have the last (special) coordinate equal to .
Plugging in the -median coresets of or , which are both of size (the first one has negative weights, which may be undesirable in some situations), we obtain a coreset of size .
1.4 Outline
In Section 2, we give preliminaries. In Section 3, we provide our main dimensionality reduction technique. In Section 4, we obtain our coresets for subspace approximation. Finally, in Section 5, we obtain our coreset for -median.
Preliminaries
We start with a few claims that will be useful to deal with norms and powers of norms. These are elementary properties about numbers and we defer the proofs to the Appendix.
Let such that . For we have .
Let such that , and . Let and . Then .
Let and and . Then
Dimensionality Reduction
Our first result is a dimensionality reduction lemma for clustering problems where the cluster centers are contained in a low-dimensional subspace such as, for example, -median clustering.
Proof: We know from the algorithm that . Furthermore, we have by the way is computed. We first consider the case when . Since is orthogonal to we know that in this case
Applying the above equality row wise we obtain
Next we consider . We define , and . We observe that and so by Claim 1 we obtain that
Again we can apply the inequality row-wise and obtain
Now we consider the final case of . Here we will make a case distinction. The first case is that . Let be the set of indices for which this inequality is satisfied. It follows by summing up over all rows in that
For the remaining case we will use Claim 2 with , and . We observe that and that since we are in the second case. Furthermore, by the choices of and . Therefore, Claim 2 implies
Applying the above inequality row wise we obtain
Summing up the two cases yields the lemma.
We observe that in the proof we only used two properties of . The first one is that and the second one is that . Thus, any subspace that satisfies these two properties will also satisfy the above lemma. We will use this later on when we discuss optimizing the running time of our algorithm.
We first consider the case of minimizing sum of distances. This case is technically less tedious and illustrates the underlying ideas.
where opt is the cost of an optimal solution to the -subspace problem with sum of distances. By orthogonality, we can write
Using Lemma 4 with , , and we obtain that
Using the triangle inequality and the fact that is the closest point in the closure of to and , respectively, we obtain
Summing up over all rows and using together with the fact that the sum of distances to is at least opt we obtain the result.
If is a -dimensional linear subspace we can slightly simplify the statement of the above theorem.
2 Dimensionality reduction for powers of Euclidean distances
In order to obtain a dimensionality reduction for powers of Euclidean distances we follow the same approach as before. The main challenge is that some calculations become more difficult as the triangle inequality is replaced by a relaxed triangle inequality.
where opt is the cost of an optimal solution to the -subspace problem with sum of powers of distances. By orthogonality, we can write
Now let us assume that (the other case is analogous). By the triangle inequality and the definition of and we have
where the last inequality follows from Claim 5 with replacing the there. We can write
Thus, using we obtain
The final result follows by summing up over all rows, replacing by , and plugging in the bound for .
Now let us assume that . By the triangle inequality and the definition of and we have
where the last inequality follows from Claim 5 with replacing the there. We can write
Thus, using we obtain
The final result follows by summing up over all rows, replacing by , and plugging in the bound for .
3 Optimizing the Running Time
We first give an alternative algorithm to our DimensionalityReduction algorithm. This algorithm can be implemented using a black box call to an algorithm for finding low dimensional subspaces approximately minimizing the norm.
There are summands in the telescoping sum, and they sum up to at most opt, so a -fraction of them must be at most . Let be the index sampled by the algorithm. Then with probability at least , we have , and let us condition on this event.
where we used that for our choice of , and also that .
Note that the overall success probability is at least in the first case and in the second, and the claimed running time follows from , and .
We also need the following lemma stating that the approximations returned by Lemma 12 suffice.
Suppose we replace the last column of with a vector for which for all . Then (1) continues to hold with replaced with .
Proof: Notice that this operation changes by at most a factor for constant , since each row changes by at most this factor. Letting denote the new matrix, we have
and rescaling by a constant factor gives the desired guarantee.
where the first equality uses the definition of , the second equality uses (3), the third equality just expands the square, the fourth equality uses (4) and that , the penultimate equality absorbs the previous equality in the asymptotic notation , and the final equality uses that .
Now, for a given , . Notice that , and consequently , and plugging into (5),
where the first equality follows by plugging into (5), the second equality follows from , the third equality follows from by definition of and the fact that is contained in a -dimensional subspace, and the final equality just uses the definition of .
Coresets for Subspace Approximation
Plugging in the guarantee of Lemma 11 into Remark 7 shows how to obtain an matrix for which
for all rank- orthogonal projection matrices . Lemma 11 shows how to efficiently find the for which , and Lemma 12 shows how to efficiently find an approximate vector of -st coordinates of . Further, after scaling by a constant factor, Lemma 13 shows that (6) continues to hold with the approximate vector of -st coordinates of furnished by Lemma 12.
Before showing how to find a sampling and rescaling matrix , we first need the following theorem due to Dvoretsky.
Proof: Let be as in Fact 15, and fix the matrix of that fact. Applying the guarantee of Fact 15 to each row of ,
where for a matrix , denotes the sum of -th powers of absolute values of its entries.
since each column of is in the column span of . Again applying the guarantee of Fact 15 to each row of , we have
and the guarantee of the lemma follows by rescaling by a constant factor.
Proof: We start by proving the structural part of the theorem, and then address the running time.
Let be the output of DimensionalityReduction, which has property (6). As described above, we can assume DimensionalityReduction produces , where and are described above. Further, we can assume is given in factored form for .
By Lemma 16, we can find a sampling and rescaling matrix for which for all rank- orthogonal projection matrices , , so
and rescaling by a constant factor gives the desired guarantee. We note that By Lemma 16, will have rows for if we run DimensionalityReduction.
Coresets for kk-Median
We can combine our dimensionality reduction with coreset computations. We first compute the matrix using our dimensionality reduction. Recall that this matrix has rank . We can therefore compute an orthogonal basis for the span of and add arbitrary dimensions. Then we apply an arbitrary coreset construction in the resulting space. We will only be interested in the space spanned by the first dimensions of (recall that the last dimension is only needed to “adjust” the distances). Since the Euclidean distance does not change under orthogonal transformations we can rotate any set of centers to our subspace without changing the distances. Therefore, the coreset will be a coreset for the whole input space.
Here contains for each row of the nearest center of , contains for each row of the nearest center of with respect to .
We get the following guarantees. Theorem 8 implies
Rescaling gives the result.
Acknowledgment
Christian Sohler acknowledges the support of the German Science Foundation (DFG) Collaborative Research Center SFB 876 ”Providing Information by Resource-Constrained Analysis”, project A2. David Woodruff acknowledges support in part by an Office of Naval Research (ONR) grant N00014-18-1-2562.
We thank Lingxiao Huang for pointing out an error in the proof of Lemma 14 in an earlier version of this paper.
References
Appendix A Appendix
Proof: ( of Claim 1) By our assumptions we have
Subtracting yields the claim.
Proof: ( of Claim 2) We observe that for the result is trivial, so we may assume . We know that and so . We write for some (the case implies and the result follows immediately). For the case we obtain
where the second inequality follows from . The last inequality follows from from (since c¿0) and hence .
Plugging this into gives
which implies the claim for by subtracting and multiplying with .
Plugging this into gives
which implies the claim since .
and the claim follows analogous to the above.
Proof: ( of Claim 3) We can assume wlog. and then this is equivalent to showing . When both sides are . The derivative, as a function of , of , for a fixed , is so the derivative is less than or equal to for every , and by the fundamental theorem of calculus,
Proof: ( of Claim 5) Observe that follows from the monotonicity of the logarithm and by the Taylor expansion of for (for the Claim follows immediately). If then . Otherwise, . In this case .
Proof: ( of Lemma 4) We have by the triangle inequality and -norm to -norm relationship,