Clustering under Perturbation Resilience
Maria Florina Balcan, Yingyu Liang
Introduction
Problems of clustering data from pairwise distance information are ubiquitous in science. A common approach for solving such problems is to view the data points as nodes in a weighted graph (with the weights based on the given pairwise information), and then to design algorithms to optimize various objective functions such as -median or min-sum. For example, in the -median clustering problem the goal is to partition the data into clusters , giving each a center , in order to minimize the sum of the distances of all data points to the centers of their cluster. In the min-sum clustering approach the goal is to find clusters that minimize the sum of all intra-cluster pairwise distances. Yet unfortunately, for most natural clustering objectives, finding the optimal solution to the objective function is NP-hard. As a consequence, there has been substantial work on approximation algorithms with both upper and lower bounds on the approximability of these objective functions on worst case instances.
Recently, Bilu and Linial suggested an exciting, alternative approach aimed at understanding the complexity of clustering instances which arise in practice. Motivated by the fact that distances between data points in clustering instances are often based on a heuristic measure, they argue that interesting instances should be resilient to small perturbations in these distances. In particular, if small perturbations can cause the optimum clustering for a given objective to change drastically, then that probably is not a meaningful objective to be optimizing. Bilu and Linial specifically define an instance to be -perturbation resilientBilu and Linial refer to such instances as perturbation stable instances. for an objective if perturbing pairwise distances by multiplicative factors in the range does not change the optimum clustering under . They consider in detail the case of Max-Cut clustering and give an efficient algorithm to recover the optimum when the instance is resilient to perturbations on the order of where is the maximal degree of the graph. They also give an efficient algorithm for unweighted Max-Cut instances that are resilient to perturbations on the order of where is the minimal degree of the graph.
Two important questions raised by the work of Bilu and Linial are: (1) the degree of resilience needed for their algorithm to succeed is quite high: can one develop algorithms for important clustering objectives that require much less resilience? (2) the resilience definition requires the optimum solution to remain exactly the same after perturbation: can one succeed under weaker conditions? In the context of center-based clustering objectives such as -median and -center, Awasthi et al. partially address the first of these questions and show that an algorithm based on the single-linkage heuristic can be used find the optimal clustering for -perturbation-resilient instances for . They also conjecture it to be NP-hard to beat and prove beating is NP-hard for a related but weaker notion (see the -center proximity property in Definition 5).
In this work, we address both questions raised by and additionally improve over . First, for the center-based objectives we design a polynomial time algorithm for finding the optimum solution for instances resilient to perturbations of value , thus beating the previously best known factor of of Awasthi et al . Second, for -median (which is a specific center-based objective), we consider a weaker, relaxed, and more realistic notion of perturbation-resilience where we allow the optimal clustering of the perturbed instance to differ from the optimal of the original in a small fraction of the points. Compared to the original perturbation resilience assumption, this is arguably a more natural though also more difficult condition to deal with. We give positive results for this case as well, showing for somewhat larger values of that we can still achieve a near-optimal clustering on the given instance (see Section 1.1 below for precise results). We additionally give positive results for min-sum clustering which is typically a harder objective than center-based objectives from approximability standpoint. For example, the best known guarantee for min-sum clustering on worst-case instances is an -approximation algorithm that runs in time for any due to Bartal et al. ; by contrast, the best guarantee known for -median is factor for any .
Our results are achieved by carefully deriving structural properties of perturbation resilience. At a high level, all the algorithms we introduce work by first running appropriate linkage procedures to produce a hierarchical clustering, and then running dynamic programming to retrieve the best -clustering present in the tree. To ensure that (under perturbation resilient instances) the hierarchy output in the first step has a pruning of low cost, we derive new linkage procedures (closure linkage and robust average linkage) which are of independent interest. While the overall analysis is quite involved, the clustering algorithms we devise are simple and robust. This simplicity and robustness allow us to show how our algorithms can be made sublinear-time by returning an implicit clustering from only a small random sample of the input.
From a learning theory perspective, the resilience parameter, , can also be seen as an analog to a margin for clustering. In supervised learning, the margin of a data point is the distance, after scaling, between the data point and the decision boundary of its classifier, and many algorithms have stronger guarantees when the smallest margin over the entire data set is sufficiently large . The parameter, similarly controls the magnitude of the perturbation the data can withstand before being clustered differently, which is, in essence, the data’s distance to the decision boundary for the given clustering objective. Hence, perturbation resilience is also a natural and interesting assumption to study from a learning theory perspective.
In this paper, we advance the line of work of by solving several important problems of clustering perturbation-resilient instances under metric center-based and min-sum objectives.
In Section 3 we improve on the bounds of for -perturbation resilient instances for center-based objectives, giving an algorithm that efficientlyFor clarity, in this paper efficient means polynomial in both (the number of points) and (the number of clusters). finds the optimum clustering for . Most of the frequently used center-based objectives, such as -median, are NP-hard to even approximate, yet we can recover the exact solution for perturbation resilient instances. Our algorithm is based on a new linkage procedure using a new notion of distance (closure distance) between sets that may be of independent interest.
In Section 4 we consider the more challenging and more general notion of -perturbation resilience for -median, where we allow the optimal solution after perturbation to be -close to the original. We provide an efficient algorithm which for produces -approximation to the optimum, where is the fraction of the points in the smallest cluster. The key structural property we derive and exploit is that, except for bad points, most points are times closer to their own center than to any other center. To eliminate the noise introduced by the bad points, we carefully partition the points into a list of sufficiently large blobs, each of which contains only good points from one optimal cluster. This then allows us to construct a tree on the blobs with a low-cost pruning that is a good approximation to the optimum.
In Section 5 we provide the first efficient algorithm for optimally clustering -perturbation resilient min-sum instances. We show that when in the order of the ratio between the sizes of the largest and smallest clusters, there exists an algorithm that can output the optimal clustering in polynomial time. Our algorithm is based on an appropriate modification of average linkage that exploits the structure of min-sum perturbation resilient instances.
We also provide sublinear-time algorithms both for the -median and min-sum objectives (Sections 4.3 and 5.1), showing algorithms that can return an implicit clustering from only access to a small random sample.
Several recent papers have showed how to exploit the structure of perturbation resilient instances in order to obtain better approximation guarantees (than those possible on worst case instances) for other difficult optimization problems. These include the game theoretic problem of finding Nash equilibria and the classic traveling salesman problem .
In the context of objective based clustering, several recent papers have showed how to exploit other notions of stability for overcoming the existing hardness results on worst case instances. The ORSS stability notion of Ostrovsky, Rabani, Schulman and Swamy assumes that the cost of the optimal -means solution is small compared to the cost of the optimal -means solution. The BBG -approximation stability condition of Balcan, Blum and Gupta assumes that every -approximation solution is close to the target clustering. We note that when the target clustering is the optimal clustering for the clustering objective, -approximation stability implies -perturbation resilience.
Awasthi, Sheffet and Blum proposed a stability condition called weak-deletion stability, and showed that it is implied by both the ORSS stability and the BBG stability. Kumar and Kannan proposed a proximity condition which assumes that in the target clustering, most data points satisfy that they are closer to their center than to any other center by an additive factor in the order of the maximal standard variance of their clusters in any direction. Their results are improved by Awasthi and Sheffet , which proposed a weaker version of the proximity condition called center separation, and designed algorithms achieving stronger guarantees under this weaker condition. These notions are not directly comparable to the perturbation resilience property.
Notation and Preliminaries
Note that in the definition, need not be a metric. Also note that the definition depends on the objective. In this paper, we focus on the center-based and min-sum objectives. For the center-based objectives, we consider separable center-based objectives defined by .
A clustering objective is center-based if the optimal solution can be defined by points in the metric space called centers such that every data point is assigned to its nearest center. Such a clustering objective is separable if it furthermore satisfies the following two conditions:
The objective function value of a given clustering is either a (weighted) sum or the maximum of the individual cluster scores.
Given a proposed single cluster, its score can be computed in polynomial time.
One particular center-based objective is the -median objective. We partition into disjoint subsets and assign a set of centers for the subsets. The objective is . The centers in the optimal clustering are denoted as . Clearly, in an optimal solution, each point is assigned to its nearest center. In such cases, the objective is denoted as .
For the min-sum objective, we partition into disjoint subsets denoted as , and the goal is to minimize . Note that we sometimes denote as in the case where the distinction is necessary, such as in Section 4.3.
In Section 4 we consider a generalization of perturbation resilience where we allow a small difference between the original optimum and the new optimum after perturbation. Formally:
Let be the optimal -clustering and be another -clustering of a set of points. We say is -close to if , where is a matching between indices of clusters of and those of .
For simplicity, we assume is an integer and assume that is known (otherwise, we can simply search over the possible different values).
α𝛼\alpha-Perturbation Resilience for Center-based Objectives
In this section we show that, for , if the clustering instance is -perturbation resilient for center-based objectives, then we can in polynomial time find the optimal clustering. This improves on the bound of and stands in sharp contrast to the NP-Hardness results on worst-case instances. Our algorithm succeeds for an even weaker property, the -center proximity, introduced in .
A clustering instance satisfies the -center proximity property if for any optimal cluster with center , with center , any point satisfies .
Any clustering instance that is -perturbation resilient to center-based objectives also satisfies the -center proximity.
The proof follows easily by constructing a specific perturbation that blows up all the pairwise distances within cluster by a factor of . By -perturbation resilience, the optimal clustering remains the same after this perturbation. This then implies the desired result. The full proof appears in . In the remainder of this section, we prove our results for -center proximity, but because it is a weaker condition, our upper bounds also hold for -perturbation resilience.
We begin with some key properties of -center proximity instances.
For any points and in the optimal clustering of an -center proximity instance, we have
,
.
Consequently, when , we have
(1) Lemma 6 gives us that . By the triangle inequality, we have . On the other hand, and therefore . Combining these inequalities, we get (1).
(2) The proof first appears in , and we include it for completeness. Without loss of generality, we can assume that . By the triangle inequality we have . From Lemma 6 we have . Hence . ∎
Lemma 7 implies for any optimal cluster , the ball of radius around the center contains only points from , and moreover, points inside the ball are each closer to the center than to any point outside the ball. Inspired by this structural property, we define the notion of closure distance between two sets as the radius of the minimum ball that covers the sets and has some margin from points outside the ball. We show that any (strict) subset of an optimal cluster has smaller closure distance to another subset in the same cluster than to any subset of other clusters or to unions of other clusters. Using this, we will be able to define an appropriate linkage procedure that, when applied to the data, produces a tree on subsets that will all be laminar with respect to the clusters in the optimal solution. This will then allow us to extract the optimal solution using dynamic programming applied to the tree.
The closure distance between two disjoint nonempty subsets and of point set is the minimum such that there is a point satisfying the following requirements:
Note that for any and . Furthermore, it can be computed in polynomial time.
For -center proximity instances, Algorithm 1 outputs the optimal clustering in polynomial time.
The proof follows immediately from the following key property of the Phase 1 of Algorithm 1. The details of dynamic programming are presented in Appendix A, and an efficient implementation of the algorithm is presented in Appendix B.
For -center proximity instances, Algorithm 1 constructs a binary tree such that the optimal clustering is a pruning of this tree.
We prove correctness by induction. In particular, assume that our current clustering is laminar with respect to the optimal clustering. That is, for each cluster in our current clustering and each in the optimal clustering, we have either , or , or . This is clearly true at the start. To prove that the merge steps keep the laminarity, we need to show the following: if is a strict subset of an optimal cluster , is a subset of another optimal cluster or the union of one or more other clusters, then there exists from , such that .
Our factor of beats the NP-hardness lower bound of of for center-proximity instances. The reason is that the lower bound of requires the addition of Steiner points that can act as centers but are not part of the data to be clustered (though the upper bound of does not allow such Steiner points). One can also show a lower bound for center-proximity instances without Steiner points. In particular for any , the problem of solving -center proximity -median instances is NP-hard . There is also a low bound for perturbation resilience. Balcan, Haghtalab and White recently showed that there is no polynomial time algorithm for -center instances under -perturbation resilience, unless NP= RP. They also showed that closure linkage solves -center instances under 2-perturbation resilience in polynomial time.
The first condition in our definition of closure distance is similar to the minimax linkage criteria . More precisely, our closure distance definition has two conditions: coverage condition and margin condition. If the margin condition is removed from the definition, then the closure distance reduces to the minimax linkage distance. For our purposes however, the margin condition is crucial — in particular, we can provably argue that when the center promixity condition is satisfied Algorithm 1 produces a tree such that the optimal clustering is a pruning of the tree (Theorem 9).
(α,ϵ)𝛼italic-ϵ(\alpha,\epsilon)-Perturbation Resilience for the k𝑘k-Median Objective
In this section we consider a natural relaxation of the -perturbation resilience, the -perturbation resilience property, that requires the optimum after perturbation of up to a multiplicative factor to be -close to the original (one should think of as sub-constant). We show that if the instance is -perturbation resilient with , then we can in polynomial time output a clustering that provides a -approximation to the optimum, where is the fraction of the points in the smallest cluster. Thus this improves over the best worst-case approximation guarantees known when and also beats the lower bound of on the best approximation achievable on worst case instances for the metric -median objective when .
The key idea is to understand and leverage the structure implied by -perturbation resilience. We show that perturbation resilience implies that there exists only a small fraction of points that are bad in the sense that their distance to their own center is not times smaller than their distance to any other centers in the optimal solution. We then use this bounded number of bad points in our clustering algorithm.
Throughout this section we will assume that is sufficiently large compared to , since for interesting practical clustering instances, one would expect that a large fraction of a optimal cluster will remain the same after small perturbation. The exact bound will be stated explicitly in our main theorems. For now we can simply assume for all .
To understand the structure of -perturbation resilience, we need to consider the difference between the optimal clustering under and the optimal clustering under a perturbation , defined as . Since by assumption, we clearly have separately for each that . Since this implies that is the unique cluster in such that . Without loss of generality, let us index so that is the identity. We denote by the center of .
In the following we introduce the notions of bad points and good points, and then show that under perturbation resilience we do not have too many bad points.
Define bad points for -median to be those that are not times closer to its own center than to any other center in the optimal clustering. That is,
The other points are called good points. Let denote the good points in cluster .
Suppose the clustering instance is -perturbation resilient and . Then .
Assume for contradiction that . The main idea is to select a subset of bad points and then construct a specific perturbation so that in the new optimal clustering these (and only these) selected bad points move to new clusters, leading to a clustering that is far from the original optimal clustering. This is contradictory to the -perturbation resilience property, and thus there are at most bad points.
The selected bad points and the perturbation are defined as follows. Select an arbitrary subset of bad points from , and let denote the selected bad points in . Let denote the second nearest center for and the nearest center for . That is, for any and any , let
The perturbation blows up all distances by a factor of except for those distances between and . Formally,
The key challenge in showing the contradiction is to show that for all , that is, the optimal centers do not change after the perturbation. Once this is shown it is then immediate that in the optimum clustering under each point is assigned to the center , and thus the selected bad points will move from their original optimal clusters and all others will not. So the distance between the new clustering and the original clustering is , which is contradictory to the -perturbation resilience property.
It will now be convenient to define a few quantities. Let (the points added when switching from to ), (the points removed), (the common points excluding selected bad points), and (the selected bad points in common). So, and . See Figure 3. Note that , , and , with the bulk of the points in .
If , then .
Assume for contradiction that . We first need to show . Clearly, , since otherwise, moving all the points in to will not increase the cost, which violates -perturbation resilience. We also know that since otherwise, there is , , which contradicts the fact that .
First, since points in are time closer to than to , the distance between and is small:
Second, since is the optimal center for , it should save a lot of cost on compared to , which suggests that and would be far apart. Formally,
When , we have . Then Inequalities 3 and 2 lead to . This means which is a contradiction to the assumptions. ∎
Suppose . If , then we have
These translations from to can be verified by the definition of . In most cases, ; the only exceptions are the distances between and . The detailed verification is presented below.
(1) Since , and by Claim 4.1, we know . So we only need to check if . We have
(2) If , then the inequality is trivial. If , then
We are now ready to present the complete proofs of the two key claims.
which implies the desired result when . ∎
For each , if then
On , the cost of is smaller than that of . Specifically, from (8) we have:
Combining the upper bound of Claim 4.3 with the lower bound of Claim 4.4 when , we get a contradiction for sufficiently large as given in the theorem statement, yielding .
The bound in Theorem 12 is optimal in the sense that for any and , we can easily construct an -perturbation resilient -median instance which has bad points.
The instance is shown in Figure 4. It has groups of points: , and . Both and have points, and has points. Let be a sufficiently large constant, say, . The distances within the same group are , while those between the points in and are , those between the points in and are , and those between the points in and are . The instance satisfies the triangle inequality, which can be verified by a case analysis. The optimal clustering before perturbation has one center in and the other in . Then are trivially bad points, and thus we have bad points in this instance.
Now we show that the instance is -perturbation resilient. To prove that the optimal clustering after perturbation is -close to the original optimal clustering, it suffices to show that has one center from and the other center from . Assume for contradiction that this is not true. If both centers come from , the cost of points in is . On the other hand, the optimal cost before perturbation is , so the optimal cost after perturbation is no more than . But this is smaller than , which is a contradiction. Similarly, we get a contradiction if both centers come from .
2 Approximation Bound
Now, we consider the problem of approximating the cost of the optimum clustering. We can see that after removing the bad points, the optimal clusters are far apart from each other. In order to get rid of the influence of the bad points, we generate a list of blobs, which form a partition of the data points, and each of which contains only good points from one optimal cluster. Then we construct a tree on the list of blobs with a pruning that assigns all good points correctly. We will show that this pruning has low cost, so the lowest cost pruning of the tree is a good approximation. The details are described in Algorithm 2.
A key step is to generate the list of almost “pure” blobs, which is described in Algorithm 3. Suppose for any and any good point , its nearest neighbors contain no good points outside . Also suppose the algorithm knows the value of . Informally, the algorithm maintains a threshold . At each threshold, for each point that has not been added to the list, the algorithm checks its nearest neighbors . It constructs a graph by connecting any two points that have sufficiently many common neighbors. It then builds another graph by connecting any two points that have sufficiently many common neighbors in , and adds sufficiently large components in to the list. Finally, for each remaining point , it checks if most of ’s neighbors are in the list and if there are blobs containing a significant amount of ’s neighbors. If so, it inserts into such a blob with the smallest median distance. Then the threshold is increased and the above steps are repeated.
The intuition behind Algorithm 3 is as follows. As mentioned above, the algorithm works when for any and any good point , the nearest neighbors of contain no good points outside ( for the -median instances considered in this section, as shown in Lemma 13; for the min-sum instances considered in Section 6, as shown in Claim 6.3). Without loss of generality, assume . When , good points in different clusters do not have most neighbors in common and thus are not connected in . However, they may be connected by a path of bad points. So we further build the graph to disconnect such paths, which ensures that the blobs added into the list contain only good points from one optimal cluster. The final insert step (Step 6) makes sure that when , all remaining good points in will be added to the list and will not affect the construction of blobs from other optimal clusters. We can show by induction that, at the end of the iteration , all good points in are added to the list. When is large enough, any remaining bad points are inserted into the list, so the points are partitioned into a list of almost pure blobs. The formal guarantee for Algorithm 3 is stated in Lemma 14.
In the following, we prove that Algorithm 2 outputs a good approximation. We first prove a key property of the good points in -perturbation resilience instances in Lemma 13 and show in Lemma 14 that the property ensures the success of Algorithm 3, and then prove a property of the bad points in Lemma 15. Finally, we use these lemmas to prove the approximation bound in Theorem 16.
When , for any good points , we have . Consequently, for any good point , all its nearest neighbors belong to .
The following proof is implicit in and we include it for completeness. We rephrase it slightly so that it is more intuitive. By the triangle inequality and the definition of good points,
Now, to compare and , we need to get rid of the extra terms and . By the same proof in Lemma 7(2),
So when , . ∎
Suppose the number of bad points is bounded by , and for any and any good point , all its nearest neighbors in are from . If , then Algorithm 3 generates a list of blobs each of size at least such that:
The blobs in form a partition of .
Each blob in contains good points from only one optimal cluster.
Without loss of generality, assume . We prove the following two claims by induction on :
For any , any blob in the list only contains good points from only one optimal cluster; all blobs have size at least .
At the beginning of the iteration , any good point has already been assigned to a blob in the list that contains good points only from .
The first two claims imply that each blob in the list contains good points from only one optimal cluster. Moreover, at the beginning of the iteration , all good points have been assigned to one of the blobs in , so there are only bad points left, the number of which is smaller than . These remaining points will eventually be assigned to the blobs before , so the blobs form a partition of .
The claims are clearly both true initially. We show now that as long as , the graphs and have the following properties.
No good point in cluster is connected in to a good point in a different cluster . By assumption, has no neighbors outside and has no neighbors outside , so they share at most neighbors.
No point is connected in to both a good point in and a good point in a different cluster . If is connected to , then . Since has no neighbors outside , contains more than points from . Similarly, if is connected to , then contains more than points from , which is contradictory. Thus, the graph looks like the illustration in Figure 5.
All the components in of size at least will only contain good points from one optimal cluster. As there are at most bad points, any two points connected in must be connected in to at least one good point. Then by the above two properties, points on a path in must be connected in to good points in the same cluster, so there is no path connecting good points from different clusters.
We can use the three properties to argue the first claim: as long as , each blob in contains good points from at most one optimal cluster. This is true at the beginning and by the third property, for any , anytime we insert a whole new blob in the list in Step 5, that blob must contain point from at most one optimal cluster. We now argue that this property is never violated as we assign points to blobs already in the list in Step 6. Suppose a good point is inserted into . Then , which means . So contains at least one good point, which must be from since contains no good points outside . Then by induction must contain only good points from , and thus adding to does not violate the first claim.
We now show the second claim: after the iteration , all the good points in have already been assigned to a blob in the list that only contains good points from . There are two cases. First, if at the beginning of the iteration , there are still at least points from the good point set that do not belong to blobs in the list. Any such good point has all neighbors in . Then any two such good points share at least neighbors. So they will connect to each other in and then in , and thus we will add one blob to containing all these points. Second, it could be that at the beginning of the iteration , all but less than good points in have been assigned to a blob in the list. Denote the points that have not yet been assigned as . Any point has no neighbors outside . Then . Also, there exists a blob containing good points from such that . Otherwise, contains at most points in , while it contains at most good points in and contains no points outside . In total, has less than points, which is contradictory. So and will be added to the list in Step 6.
We then iterate the argument on the remaining set . The key point is that for , we have that all the good points in have already been assigned to blobs in . ∎
Lemma 13 and 14 show that Algorithm 3 with parameters and produces a list of sufficiently large, almost pure blobs. Then the robust linkage procedure in can build a tree on these blobs with a pruning that assigns all good points correctly. Now it suffices to show that this pruning is a good approximation, for which we need to bound the cost increased by the bad points assigned incorrectly. The following property of these bad points turns out to be useful. Intuitively, Algorithm 3 is designed such that whenever a bad point is added to a blob containing good points from a different cluster, it must be closer to a significant number of points in that cluster than to a significant number of points in its own cluster. Then the cost increased by incorrectly assigning each such bad point is small, resulting in a good approximation.
Suppose for any good point , all its nearest neighbors in are from , and . When running Algorithm 3 with , if a bad point is assigned to a blob containing good points from a different optimal clustering , then there exist points from , and points from , such that .
There are two cases: is added into in (1) Step 5 or (2) Step 6.
There must be a path in connecting to a good point in at threshold . For any edge in , since share at least neighbors in and there are at most bad points, they share at least one good point as neighbor in . As shown in the proof of Lemma 14, no point can connect to good points from different clusters, so in all points on the path must connect to good points in . In particular, is connected in to a good point . Then . Since is still in , , and thus contains no points outside . This means that at least points in are good points in , then we can select points from . We also have that at most points in are points in , so we can select points from .
There are three subcases when is inserted into at threshold .
There is no good points from in the list. Since , contains at most this number of good points in . This means at least good points in are outside , from which we can select . On the other hand, we can select as follows. When inserting into , we have . Since contains only good points from and some bad points, contains at least good points in , from which we can select . Since are from and are outside , we have .
There exists containing good points from , but . This means , so there are at least points in are outside . At least of these points are good points from , since contains only good points from and at most bad points. So, we can select from them. On the other hand, we can select as in the first subcase.
There exists containing good points from . Since is assigned to rather than according to median distances, we know that at least half of the points from are closer to than at least half of the points from . Since there are at most bad points, we can select good points from and select good points from . Note that are all from and are all from , so .
Therefore, the statement is true in all cases. ∎
If the clustering instance is -perturbation resilient for and where , then Algorithm 2 produces a clustering which is -approximation to the optimal clustering with respect to the -median objective in polynomial time.
By Lemma 13 and 14, Algorithm 3 partitions the points into a list of blobs, each of which has size at least and contains only good points from one optimal cluster. Let denote the bad points that are assigned to blobs containing good points in . By Lemma 13, Theorem 9 in can be applied to , by which we know that is a pruning of the tree. Suppose the cost of the optimum is . We now show that this pruning, using the original centers , is a -approximation to .
Suppose a bad point is assigned to a blob containing good points from a different optimal cluster . By Lemma 15, there exist points from , and points from , such that . Then the increase in cost due to is bounded as follows:
As there are at most bad points and , the increase of cost is at most .
In Algorithm 3, for each , we first sort all the other points in ascending order of distances in time . At each threshold , think of a directed -regular graph , where, for each point in the nearest neighbors of a point , there is a directed edge from to in . Let denote the adjacency matrix for , and let . Then is the number of common neighbors between and , which can be used in constructing . Computing takes time , where is the matrix multiplication exponent. The same method can be used to compute the number of common neighbors in and construct . Since there are thresholds, the total time for constructing and is . For the other steps, adding a blob takes time and inserting a point takes time . These steps can be performed at most times, so they take time. In total, Algorithm 3 takes time . Since the robust linkage algorithm takes time at most , and the dynamic programming takes time (Appendix A), the running time of Algorithm 2 is . ∎
3 Sublinear Time Algorithm for the k𝑘k-Median Objective
Consider a clustering instance that is -perturbation resilient to -median. For simplicity, suppose the distances are normalized such that . Let . Let denote the fraction of the points in the smallest cluster, denote the average cost of the points in the optimum clustering.
Suppose is -perturbation resilient for , . Then with probability , Algorithm 4 outputs an implicit clustering that is -approximation in time .
By the union bound, we have with probability at least ,
On the other hand, . The second inequality comes from an argument similar to that in Theorem 16 and the fact that is different from only on the bad points. The first inequality comes from the triangle inequality. More precisely, for any ,
If we have an oracle that given a set of points finds the best center in for that set, then we can save a factor of in the approximation factor.
α𝛼\alpha-Perturbation Resilience for the Min-Sum Objective
For -perturbation resilient instances, Algorithm 5 outputs the optimal min-sum -clustering in polynomial time.
Proof of Theorem 18. We now present the formal proof of the theorem. We first prove the key claims mentioned in the intuition.
By the triangle inequality, for any and ,
Summing over all and , we have
We consider a specific perturbation and use the fact that the optimum does not change after the perturbation. The perturbed metric is defined as:
Suppose the clustering instance is -perturbation resilient to min-sum for . Then the following statements are true:
For any two different optimal clusters and and any nonempty , if and are larger than , then
For any point , all its nearest neighbors are in the same optimal cluster.
(1) Let and . By Claim 5.1 and Fact 5.1,
Divide Inequality (12) by , divide Inequality (13) by , add them up, and move the and terms to the left-hand side:
Since , and are large enough, and . So,
(2) Suppose comes from the optimal cluster . Let , and suppose .
We are now ready to use the lemmas to prove our theorem. It is sufficient to show that in Algorithm 5:
Initially each satisfies for some ;
is always laminar to the optimal clustering , that is, for any and , we have either , or , or .
Then the minimum cost pruning of will be the optimal clustering, which can be obtained by dynamic programming.
Claim 5.2(2) implies that initially each satisfies for some . This means that is laminar initially. Then Claim 5.2(1) can be used to show that the merge steps preserve the laminarity, so is always laminar to the optimal clustering.
More precisely, we prove the laminarity by induction. By Claim 5.2(2), is laminar initially. It is sufficient to prove that if the current clustering is laminar, then the merge step keeps the laminiarity. Assume that our current clustering is laminar to the optimal clustering. Consider a merge of two clusters and . There are two cases when laminarity could fail to be satisfied after the merge:
and are strict subsets from different optimal clusters, that is, ;
is a strict subset of an optimal cluster and is the union of one or several other optimal cluster(s).
where the last inequality comes from and . This contradicts Claim 5.1. So the merge of the two clusters and will preserve the laminarity.
1 Sublinear Algorithm for the Min-Sum Objective
Our main result in this subsection is the following.
Suppose the clustering instance is -perturbation resilient to the min-sum objective where . Then with probability at least , Algorithm 6 outputs an implicit optimum clustering in time .
To prove the theorem, we first show the following (Lemma 20): with high probability, in Algorithm 5 is always laminar to . The key idea is that when the sample is sufficiently large, we have that for any and ,
We now present the proofs of the lemmas that imply the correctness of the theorem.
Suppose the clustering instance is -perturbation resilient to the min-sum objective for . When , with probability at least , in Algorithm 5 is always laminar to .
First, since , by the Chernoff bound we have
Set . By the union bound, with probability at least , for any ,
Similarly, with probability at least , for any and ,
Now, fix any and . We have
By the union bound, with probability at least , for any and ,
Now, by (14), we have , . Combining these bounds with (15) and (16), we have that with probability at least , for any and any ,
Suppose the clustering instance is -perturbation resilient to the min-sum objective for . When , with probability at least , is the unique minimum min-sum cost pruning of the tree in Algorithm 5.
With probability at least , for any three different optimal clusters , and any ,
Now, we use Claim 5.4 to prove the optimality of . Suppose a pruning is obtained by splitting clusters in and at the same time joining some other clusters into unions. Specifically, for , split into clusters ; after that, merge into unions, that is, for and , merge clusters into a union ; the other clusters in remain the same in . Since the number of clusters is still , we have . The cost saved by splitting clusters is
The cost increased by joining clusters is
To prove that is the unique minimum cost pruning, we need to show that (18) is less than (19). Since each term in (19) is twice larger than any term in (18), it suffices to show that the number of the terms in (19) is at least half the number of the terms in (18). Formally, we need to show
We have , where the inequality comes from . Since , it is sufficient to show . This comes from since . ∎
(α,ϵ)𝛼italic-ϵ(\alpha,\epsilon)-Perturbation Resilience for the Min-Sum Objective
Suppose the instance is -perturbation resilient to the min-sum objective for and . There exists an algorithm that outputs a clustering which is a -approximation to the optimal clustering in polynomial time. Furthermore, the output clustering is also -close to the optimal clustering.
Since , the approximation factor is always and gets better if gets smaller. To prove the theorem, we first derive new useful structural properties implied by -perturbation resilience for min-sum, and then use them to design our algorithm achieving the guarantees in the theorem. Throughout this section, we assume and , except for where their values are explicitly specified. Also, since we may assume without loss of generality that .
The rest of the section is organized as follows. In Section 6.1, we prove useful properties of the -perturbation resilient min-sum instances. We first show that in the optimal clustering, except for a few bad points, all the other points are good in the sense that they are much closer to their own clusters than to any other clusters. Furthermore, we show that there exist a subset of points we call potentially good points which can act as a proxy for the good points in the clustering tasks. Given these properties, we design an algorithm in Section 6.2. We first construct a tree with a pruning close to the optimal clustering, find that pruning, and finally adjust the points so that the pruning becomes the desired approximation.
We describe the high level ideas for the structural properties, and then present the formal proofs in Section 6.1.1 and Section 6.1.2.
The good points and bad points for min-sum are defined as follows. Here is chosen to be since we are not able to prove the bound for but will be able to when is slightly smaller than . Some other constant can be used instead of .
Define bad points for min-sum to be those that are not times closer to their own clusters than to other clusters, where . That is,
The other points are called good points.
Once we bound the number of bad points, it is possible to design approximation algorithms if the influence of the few bad points can be eliminated, since the good points in different optimal clusters are far from each other by definition, and thus can be handled by simple algorithms (such as the variant of average linkage algorithm used for -perturbation resilient min-sum instances). However, it is unclear how to compute the bad points or the good points. The key is to introduce a proxy called potentially bad points (potentially good points respectively), which can be easily computed. These notions are formalized as follows.
For a set with , define the potentially bad points to be the points in that are farthest from . That is, , and for any , , . The potentially good points of are defined to be .
To show that the potentially good points can be regarded roughly as a proxy for the good points, we show that the cost between sufficiently many good points in two clusters accounts for most of the cost between the two clusters (Lemma 27), and that the cost between any points and the potentially good points in a cluster is roughly bounded by the cost between these points and any sufficiently large subset (in particular, the good points) of the cluster (Lemma 28). The first statement is due to that there are just a few bad points and the good points in different clusters are far apart. The second is due to that by definition, the potentially bad points are furthest away from other points in the cluster, so removing other points will not change the cost as much as removing the potentially bad points, even in the worst case.
Since the potentially good points can act as a proxy, the robust average distance approximates the average distance between good points, and the robust min-sum cost computed after removing the potentially bad points approximates the min-sum cost computed after removing the actual bad points. Thus, they can be used to design approximation algorithms using the potentially bad points as if we knew the actual bad points, as done in Section 6.2.
Suppose the clustering instance is -perturbation resilient to the min-sum objective for and . Then .
We will first show that where , and then show that , completing the proof.
As the first step, assume for contradiction . We will construct a perturbation which will eventually lead to a contradiction.
We will show that (21) is larger than (22), leading to the contradiction.
are the selected bad points in that need to be moved out.
These different types of points have the following relations:
We now consider the costs saved and added when moving these points for all clusters . Suppose we first move out , then , and finally . The cost saved by moving out is defined as
The cost saved by moving out is
The cost saved by moving out is
where the last inequality follows from . Then we have . ∎
1.2 Properties of Good Points and Potentially Good Points
Since there are just a few bad points and the good points in different clusters are far apart, the cost between sufficiently large subsets of their good points accounts for most of the cost between the two clusters. This means that we would be able to approximate the min-sum cost of all points by the min-sum cost only on the good points, if we knew the good points (Lemma 27). To prove Lemma 27, we will need the triangle inequality for the average distance, and also a technical lemma which shows that good points are much closer to its own cluster than to good points in any other cluster.
For any nonempty , we have
Plug the second inequality into the first inequality, then the lemma follows. ∎
Now we turn to analyze the potentially good points. A key property of the potentially good points is the following: for any point and any sufficiently large set , the cost between and the potentially good points in is roughly bounded by the cost between and any sufficiently large subset of . See Lemma 28 for details. A specific case is when is the actual good points in . In this case, the property says that the cost between and the potentially good points is roughly bounded by the cost between and the actual good points. This means that in suitable situations, we can regard potentially good points as actual good points.
The lemma then follows from these two inequalities and the following claim.
Since and , we have . Then the lemma follows from the fact that and . ∎
This then completes the proof of Lemma 28. ∎
2 Approximation Bound
In this subsection, we design an approximation algorithm and prove our final result Theorem 22 by utilizing the properties of the -perturbation resilience.
First, note that we can generate a list of sufficiently large almost “pure” blobs using Algorithm 3. However, unlike for -perturbation resilient -median instances, it is not guaranteed that the robust linkage procedure in can link these blobs into a tree so that a pruning of the tree assigns all but bad points correctly. Fortunately, since the potentially good points can act as a proxy for the good points, we can pretend there are only good points. Since the average linkage succeeds in this case (as shown for the -perturbation resilient instances), one would expect that the same idea can be applied. Indeed, we apply the idea but using the robust average distance instead of the average distance. As described in Algorithm 7, we first use Algorithm 3 to generate a list of blobs, and then use a robust version of average linkage to link them into a tree: repeatedly merge the two blobs with the minimum robust average distance.
After building the tree, one would like to find the pruning that assigns all but bad points correctly. Suppose we can remove the actual bad points and compute the cost between the good points. Since the good points from different clusters are far apart, the good point cost increased by joining different clusters in is larger than that saved by splitting clusters in (Lemma 32). Then any other pruning has larger cost than . Unfortunately, we do not know the actual good points. Therefore, we consider the potentially good points and compute the robust min-sum cost. We show that the pruning is in fact the pruning with the minimum robust min-sum cost, so that it can be computed in polynomial time by dynamic programming.
However, this pruning may not be a good approximation. For example, consider an instance consisting of two unbalanced clusters. Assume that there is only one bad point, belonging to the small cluster. Further assume the distances between the good points in each cluster are negligible, then assigning the bad point incorrectly to the large cluster will lead to an -approximation. So the pruning may not be a constant approximation. Notice that the bad point causing trouble in this example can actually be identified: it is closer to its own optimal cluster than to its cluster in . Then by reassigning the points in , a better approximation can be computed. It turns out that the reassignment is useful beyond this particular example, and can be used to compute a good approximation for general perturbation resilient instances. The details are described in Algorithm 8.
All these combined together lead to our final algorithm for -perturbation resilient min-sum instances, summarized in Algorithm 9.
The rest of the subsection presents the formal proofs. In Section 6.2.1, we show that Algorithm 7 outputs a tree with a pruning that assigns all but bad points correctly. In Section 6.2.2, we show that this pruning can be found in polynomial time by dynamic programming. In Section 6.2.3, we show Algorithm 8 computes a good approximation, completing the proof of Theorem 22.
We now present our guarantee of Algorithm 7.
The tree output in Algorithm 7 has a pruning that assigns all good points correctly.
To analyze the algorithm, we begin with the following property of good points. When combined with the property of Algorithm 3 (Lemma 14), it immediately shows that each blob in the list has size at least , and contains good points from only one optimal cluster.
For any , all its nearest neighbors belong to .
It now suffices to prove by induction that the clustering is always laminar to . It is true at the beginning by the property of Algorithm 3. Assume for contradiction that the laminarity is first violated after merging and . There are two cases:
and are strict subsets of different optimal clusters;
is a strict subset of while is the union of the good points in several optimal clusters.
We have the following statements for the two cases respectively. By these two statements, we should first merge with rather than with , which is contradictory and completes the proof.
(1) It follows from the following three statements:
We now prove the statements respectively.
(a) For simplicity, let . From Lemma 26, we have
where the last step follows from , is at least .
(b) By Lemma 28 and the fact that and , we have
Then the claim follows from the fact that .
(c) For simplicity, let . Divide into two parts: and . Define and similarly. See Figure 9 for an illustration.
Since and , we have
(2) The proof idea is similar to that for Claim 6.4.(1). The only difference is the proof for
Since , it suffices to show that
for any , which can be proved by the same argument as in Claim 6.4.(1). ∎
Applying the claim completes the proof of Lemma 29. ∎
2.2 Getting A Pruning Close to the Optimal Clustering
We now show that the pruning that assigns all good points correctly is the pruning with the minimum robust min-sum cost.
Suppose the pruning in tree assigns all good points correctly. Then is the minimum robust min-sum cost pruning in the tree.
Computing the robust min-sum cost will eliminate the effect of the bad points and work as if we knew the actual good points: the robust min-sum cost saved by splitting a node is at most the good point cost saved (Claim 6.5), and the robust min-sum cost increased by merging two nodes is of the same order as the good point cost increased (Claim 6.6 and Corollary 31).
Let , and . Define ; define , similarly. Also, define . See Figure 10. Then the left-hand side of the statement is
The same argument as that for Claim 6.6 leads to a corollary for the general case when multiple clusters are merged.
Let . Suppose for any , , and contains all good points in but no good points in other optimal clusters. Then
Besides these claims, another key property we need is that the good points in different optimal clusters are far apart in the sense that the good points from two different clusters have cost much larger than those in a third cluster have, as formalized in Lemma 32. The proof of this lemma is technical and not related to the other parts of the proof, so we defer it to Appendix C.2.
Given the claims and Lemma 32, We are now ready to prove Lemma 30.
First, by Lemma 32, good points from different clusters are far apart while good points in the same cluster are close. Second, by Claim 6.5 and Corollary 31, the cost of good points can be approximated by the cost of the potentially good points (the robust min-sum cost). We now use the above lemmas to show that has minimum robust min-sum cost, so that we can use dynamic programming on the tree to get the pruning.
Suppose a pruning is obtained by splitting clusters in and at the same time joining some other clusters into unions. Specifically, for , split into clusters ; after that, merge into unions, that is, for , , merge clusters into a union ; the other clusters in remain the same in . Since the number of clusters is still , we have .
By Claim 6.5, the cost saved by splitting the clusters is
The cost increased by joining clusters is
where the first inequality follows from Claim 6.5, and the second inequality follows from Corollary 31. To prove is the minimum cost pruning, we need to show that the saved cost (32) is less than the increased cost (33). Since by Lemma 32, each term in (33) is larger than any term in (32), it is sufficient to show that the number of the terms in (33) is no less than the number of the terms in (32), that is We have , where the inequality is from . Since , , which completes the proof. ∎
2.3 Getting a Good Approximation
We now show that Algorithm 8 outputs a good approximation. We first prove that after reassignment all good points are still assigned correctly (Lemma 33), and then bound the cost.
where the last step follows from Lemma 28. ∎
We are now ready to prove our final result.
Proof of Theorem 22. By Lemma 33, all the good points in are assigned correctly to . Let denote all the bad points assigned to . The cost of the output clustering can be written as follows.
Let . See Figure 11 for an illustration. By Fact 6.1,
where the second step follows from Lemma 28 and the last from and . Then
The claim follows from the inequalities (6.2.3), (37) and . ∎
The proof of correctness is completed by combining Claim 6.7, (6.2.3), and (35).
Algorithm 3 takes time (as shown in the proof of Theorem 16), and the rest steps of Algorithm 7 take time . Finding the minimum robust min-sum cost pruning in the tree output by Algorithm 7 takes time , and Algorithm 8 takes time . So the total running time is .
Discussion and Open Questions
We advance the line of research on clustering under perturbation resilience in multiple ways. For -perturbation resilient instances, we improve on the known guarantees for center-based objectives and give the first analysis for min-sum. Furthermore, for -median and min-sum, we analyze and give the first algorithmic guarantees known for a relaxed but more challenging condition of -perturbation resilience, where an fraction of points are allowed to move after perturbation. We also give sublinear-time algorithms for -median and min-sum under perturbation resilience.
A natural direction for future investigation is to explore whether one can take advantage of smaller perturbation factors for perturbation resilient instances in Euclidian spacesThat is, where is a Euclidean metric, though as in Definitions 1 and 4, need not be. Alternatively, one could also consider a natural version of Definitions 1 and 4 in which must be Euclidean as well, and in fact implemented via a perturbation of coordinate values.. More broadly, it would be interesting to explore other ways in which perturbation resilient instances behave better than worst case instances (e.g., natural algorithms converge faster).
Another interesting direction is to design clustering algorithms under perturbation resilience whose output satisfies certain privacy requirements. For example, some stability notions can be useful for differential private analysis . It would be interesting to explore the perturbation resilience property and design efficient clustering algorithms that preserve differential privacy.
We thank Avrim Blum for numerous useful discussions. This work was supported in part by NSF grants CCF-0953192, CCF-1101283, CCF-1451177, ONR N00014-09-1-0751, AFOSR grant FA9550-09-1-0538, a Microsoft Faculty Fellowship, a Google Research Award, and a Sloan Fellowship.
References
Appendix A Finding the Minimum Cost k𝑘k-Cluster Pruning
The idea of using dynamic programming to find the optimal -clustering in a tree of clusters is proposed in . We can find the optimal clustering by examining the entire tree of clusters produced.
First recall our setting. Suppose we have a tree whose leaves are the data points. Each internal node of the tree represents a cluster that contains all points in the clusters represented by its children. Also suppose that the clustering objective is separable: (1) the objective function value of a given clustering is either a (weighted) sum or the maximum of the individual cluster scores; (2) given a proposed single cluster, its score can be computed in polynomial time. Our goal is to find a pruning of the tree that has clusters and has minimum cost.
Appendix B An Efficient Implementation of Algorithm 1
Here we show an efficient implementation of Algorithm 1, namely Algorithm 11. This implementation takes time only .
Note that at each merge step in Algorithm 1, we only need to find the two clusters with the minimum closure distance. So we hope to compute the minimum closure distance without computing all the distances between any two current clusters. First we notice the following facts.
In the execution of Algorithm 1, if is the minimum closure distance for the current clustering, then
there exist such that ;
is no less than the minimum closure distances in previous clusterings.
For the first claim, let be the center of the ball in the definition of closure distance, and be the farthest point from the center in the ball, then . The second claim comes from the fact that the clusters in the current clustering are supersets of those in previous clusterings. ∎
Fact B.1 implies that we can check in ascending order the pairwise distances no less than the minimum closure distance in the last clustering, and determine if the checked pairwise distance is the minimum closure distance in the current clustering. More specifically, suppose we have some black-box method for checking if a pairwise distance is the minimum closure distance in the current clustering, we can perform the closure linkage as follows: sort the pairwise distances in a list in ascending order; start from the first distance in the list; check if the current distance is the minimum closure distance in the current clustering; if it is, merge clusters covered by the ball defined by the checked distance; continue to check the next distance in the list. So it is sufficient to design a method to determine if a pairwise distance is the minimum closure distance in the current clustering. Our method is based on the following facts.
In Algorithm 1, if is the minimum closure distance for the current clustering, then
Notice if a pairwise distance satisfies the three claims, then it defines a closure distance for the clusters covered. So if we check the pairwise distances in ascending order, then the first one that satisfies the three claims must be the minimum closure distance in the current clustering. So we have a method to determine if a pairwise distance is the minimum closure distance.
However, naively checking the third claim in Fact B.2 takes , which is still not good enough. We can refine this step since intuitively, for every , if comes after in the distance list, then when checking , we can utilize the information obtained from checking . To do so, we introduce some notations.
For every , define to be a sorted list of points in , according to their distances to in ascending order.
Define to be the maximum such that there exits satisfying ; if no such point exists, let .
Define to be the maximum such that ; if no such exists, let .
Intuitively, is the index of the farthest point in , which makes fail the third claim in Fact B.2. Then satisfies the third claim if and only if , thus we turn the task of checking the claim into computing . In order to use the information obtained when previously checking , we compute from . By the definition of , is either the maximum such that there exits satisfying , or the maximum there exits satisfying . Then it is easy to verify that
It takes time to compute , thus we can compute for all in time. The implementation is finally summarized in Algorithm 11.
Appendix C (α,ϵ)𝛼italic-ϵ(\alpha,\epsilon)-Perturbation Resilient Min-Sum Instances
We are ready to prove the claim needed for bounding the number of bad points.
The claim follows by summing (40) and (41) over and plugging in the last two inequalities. ∎
The claim follows by summing (42) and (43) over and plugging the last two inequalities. ∎
The claim follows by summing (44) and (C.1) over and plugging the last two inequalities. ∎
C.2 Properties of Good Points in Min-Sum
To bound the cost of , we compare it to the cost of the optimal clustering before perturbation. If , then the cost is only increased by blowing up the distances between and (Claim C.1). However, the optimal clustering may change after the perturbation, so we need to consider how much cost is saved by the change (Claim C.2).
Suppose and . We have
Let . See Figure 12 for an illustration. We have
The first term on the right-hand side corresponds to the cost increased by blowing up the distances within the clusters, the second term corresponds to the cost increased by moving points away. We will bound the two terms respectively in the following two claims, which then lead to the lemma.
Let denote the index of the optimal cluster in that falls in: if , then . Similarly, let denote the optimal cluster in that falls in after perturbation: if , then .
By the definition of the perturbation, we have
Let .
Since , and , the second term on the right-hand side is bounded by
The claim follows from the inequalities (46), (47), and (48). ∎
The proof is completed by combining the two claims. ∎