Center-based Clustering under Perturbation Stability

Pranjal Awasthi, Avrim Blum, Or Sheffet

Introduction

Problems of clustering data arise in a wide range of different areas – clustering proteins by function, clustering documents by topic, and clustering images by who or what is in them, just to name a few. In this paper we focus on the popular class of center based clustering objectives, such as kk-median, kk-center and kk-means. Under these objectives we not only partition the data into kk subsets, but we also assign kk special points, called the centers, one in each cluster. The quality of a solution is then measured as a function of the distances between the data points and their centers. For example, in the kk-median objective, the goal is to minimize the sum of distances of all points from their nearest center, and in the kk-means objective, we minimize the sum of the same distances squared. As these are NP-hard problems , there has been substantial work on approximation algorithms with both upper and lower bounds on approximability of these and other objective functions. Note that we are especially interested in the case that kk is part of the input and not a constant.

Recently, Bilu and Linial , focusing on the Max-Cut problem , proposed considering instances where the optimal clustering is optimal not only under the given metric, but also under any bounded multiplicative perturbation of the given metric. This is motivated by the fact that in practice, distances between data points are typically just the result of some heuristic measure (e.g., edit-distance between strings or Euclidean distance in some feature space) rather than true “semantic distance” between objects. Thus, unless the optimal solution on the given distances is correct by pure luck, it likely is correct on small perturbations of the given distances as well. Bilu and Linial analyze Max-Cut instances of this type and show that for instances that are stable to perturbations of multiplicative factor roughly O(n1/2)O(n^{1/2}), one can retrieve the optimal Max-Cut in polynomial time. However, they conjecture that stability up to only constant magnitude perturbations should be enough to solve the problem in polynomial time. In this paper we show that this conjecture is indeed true for kk-median and kk-means objectives and in fact for any well-behaved center-based objective function (see Definition 1.3).

First, let us formally define the notion due to of stability under multiplicative perturbations, stated in this context.

Note that d′d^{\prime} may be any non-negative function, and need not be a metric.

Suppose we have a clustering instance composed of nn points residing in a metric (S,d)(S,d) and an objective function Φ\Phi we wish to optimize. We call the clustering instance α\alpha-perturbation resilient for Φ\Phi if for any d′d^{\prime} which is an α\alpha-perturbation of dd, the (only) optimal clustering of (S,d′)(S,d^{\prime}) under Φ\Phi is identical, as a partition of points into subsets, to the optimal clustering of (S,d)(S,d) under Φ\Phi.

We will in particular be concerned with separable, center-based clustering objectives Φ\Phi (which include kk-median, kk-means, and kk-center among others).

A clustering objective is center-based if the optimal solution can be defined by kk points c1∗,…,ck∗c^{*}_{1},\ldots,c^{*}_{k} 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.

Our main result is that we can efficiently find the optimal clustering for perturbation-resilient instances of separable center-based clustering objectives. In particular, we get an efficient algorithm for 3-perturbation-resilient instances when the metric SS is defined only over data points, and for (2+3)(2+\sqrt{3})-perturbation-resiliant instances for general metrics.

For α≥3\alpha\geq 3 (in the case of finite metrics defined only over the data) or α≥2+3\alpha\geq 2+\sqrt{3} (for general metrics), there is a polynomial-time algorithm that finds the optimal clustering of α\alpha-perturbation resilient instances for any given separable center-based clustering objective.

The algorithm, described in Section 2.2, turns out to be quite simple. As a first step, it runs the classic single-linkage algorithm, but unlike the standard approach of halting when kk clusters remain, it runs the algorithm until all points have been merged into a single cluster and keeps track of the entire tree-on-clusters produced.The example depicted in Figure 3 proves that indeed, halting the Single-Linkage algorithm once kk clusters are formed may fail on certain α\alpha-perturbation resilient instances. Then, the algorithm’s second step is to apply dynamic programming to this hierarchical clustering to identify the best kk-clustering that is present within the tree. Using a result of Balcan et al. we show that the resulting clustering obtained is indeed the optimal one. Albeit being very different, our approach resembles, in spirit, the work of Bartal , Abraham et al and Räcke in the sense that we reduce the problem of retrieving an optimal solution from a general instance to a tree-like instance (where it is poly-time solvable).

Our algorithms use only a weaker property, which we call center-proximity (see Section 2.1), that is implied by perturbation-resilience. We then complement these results with a lower bound showing that for the problem of kk-median on general metrics, for any ϵ>0\epsilon>0, there exist NP-hard instances that satisfy (3−ϵ)(3-\epsilon)-center proximity.We note that while our belief was that allowing Steiner points in the lower bound was primarily a technicality, Balcan et al. (M.F. Balcan, personal communication) have recently shown this is not the case, giving a clever algorithm that finds the optimal clustering for kk-median instances in finite metrics when α=1+2\alpha=1+\sqrt{2}.

2 Related work

There have been a number of investigations of different notions of stability for the problem of clustering. For example, Ostrovsky et al. consider a kk-means instance to be stable if the optimal kk-clustering is substantially cheaper than the optimal (k−1)(k-1)-clustering under this objective. They present an efficient algorithm for finding near-optimal kk-means clusterings when this gap is large, and these results were subsequently strengthened to apply to smaller gaps in . Balcan et al. consider instead a clustering instance to be stable if good approximations to the given objective are guaranteed to be close, as clusterings, to a desired ground-truth partitioning. This is motivated by the fact that when the true goal is to match some unknown correct answer (e.g., to correctly cluster proteins by their function), this is an implicit assumption already being made when viewing approximation ratio as a good performance measure. Balcan et al. show that in fact this condition can be used to bypass approximation hardness results for a number of clustering objectives including kk-median and kk-means. Here they show that if all (1+α)(1+\alpha)-approximations to the objective are δ\delta-close to the desired clustering in terms of how points are partitioned, then one can efficiently get O(δ/α)O(\delta/\alpha)-close to the desired clustering. Ben-David et al. consider a notion of stability of a clustering algorithm, which is called stable if it outputs similar clusters for different sets of nn input points drawn from the same distribution. For kk-means, the work of Meila discusses the opposite direction – classifying instances where an approximated solution for kk-means is close to the target clustering.

Proof of Main Theorem

We begin by deriving other properties which every α\alpha-perturbation resilient clustering instance must satisfy.

Let p∈Sp\in S be an arbitrary point, let ci∗c^{*}_{i} be the center pp is assigned to in the optimal clustering, and let cj∗≠ci∗c^{*}_{j}\neq c^{*}_{i} be any other center in the optimal clustering. We say a clustering instance satisfies the α\alpha-center proximity property if for any pp it holds that

If a clustering instance satisfies the α\alpha-perturbation resilience property, then it also satisfies the α\alpha-center proximity property.

Let Ci∗C^{*}_{i} and Cj∗C^{*}_{j} be any two clusters in the optimal clustering and pick any p∈Ci∗p\in C^{*}_{i}. Assume we blow up all the pairwise distances within cluster Ci∗C^{*}_{i} by a factor of α\alpha. As this is a legitimate perturbation of the metric, it still holds that the optimal clustering under this perturbation is the same as the original optimum. Hence, pp is still assigned to the same cluster. Furthermore, since the distances within Ci∗C^{*}_{i} were all changed by the same constant factor, ci∗c_{i}^{*} will still remain an optimal center of cluster ii. The same holds for cluster Cj∗C^{*}_{j}. It follows that even in this perturbed metric, pp prefers ci∗c^{*}_{i} to cj∗c^{*}_{j}. Hence αd(p,ci∗)=d′(p,ci∗)<d′(p,cj∗)=d(p,cj∗)\alpha d(p,c^{*}_{i})=d^{\prime}(p,c^{*}_{i})<d^{\prime}(p,c^{*}_{j})=d(p,c^{*}_{j}). ∎

For every point pp and its center ci∗c^{*}_{i}, and for every point p′p^{\prime} from a different cluster, it follows that d(p,p′)>(α−1)d(p,ci∗)d(p,p^{\prime})>(\alpha-1)d(p,c^{*}_{i}).

Denote by cj∗c^{*}_{j} the center of the cluster that p′p^{\prime} belongs to. Now, consider two cases. Case (a): d(p′,cj∗)≥d(p,ci∗)d(p^{\prime},c^{*}_{j})\geq d(p,c^{*}_{i}). In this case, by traingle inequality we get that d(p,p′)≥d(p′,ci∗)−d(p,ci∗)d(p,p^{\prime})\geq d(p^{\prime},c^{*}_{i})-d(p,c^{*}_{i}). Since the data instance is stable to α\alpha-perturbations, Fact 2.2 gives us that d(p′,ci∗)>αd(p′,cj∗)d(p^{\prime},c_{i}^{*})>\alpha d(p^{\prime},c_{j}^{*}). Hence we get that d(p,p′)>αd(p′,cj∗)−d(p,ci∗)d(p,p^{\prime})>\alpha d(p^{\prime},c^{*}_{j})-d(p,c^{*}_{i}) ≥(α−1)d(p,ci∗)\geq(\alpha-1)d(p,c^{*}_{i}). Case (b): d(p′,cj∗)<d(p,ci∗)d(p^{\prime},c^{*}_{j})<d(p,c^{*}_{i}). Again by traingle inequality we get that d(p,p′)≥d(p,cj∗)−d(p′,cj∗)>αd(p,ci∗)−d(p′,cj∗)>(α−1)d(p,ci∗)d(p,p^{\prime})\geq d(p,c^{*}_{j})-d(p^{\prime},c^{*}_{j})>\alpha d(p,c^{*}_{i})-d(p^{\prime},c^{*}_{j})>(\alpha-1)d(p,c^{*}_{i}). ∎

A key ingredient in the proof of Theorem 1.4 is the tree-clustering formulation of Balcan et. al . In particular, we prove that if an instance satisfies α\alpha-center proximity for α≥3\alpha\geq 3 (in the case of finite metrics without Steiner points) or for α≥2+3\alpha\geq 2+\sqrt{3} (for general metrics) then it also satisfies the “min-stability property” (defined below). The min-stability property, as shown in , is sufficient (and necessary) for the Single-Linkage algorithm to produce a tree such that the optimal clustering is some pruning of this tree. In order to define the “min-stability” property, we first introduce the following notation. For any two subsets A,B⊂SA,B\subset S, we denote the minimum distance between AA and BB as dmin⁡(A,B)=min⁡{d(a,b) ∣ a∈A,b∈B}d_{\min}(A,B)=\min\{d(a,b)\ |\ a\in A,b\in B\}.

A clustering instance satisfies the min-stability property if for any two clusters CC and C′C^{\prime} in the optimal clustering, and any subset A⊊CA\subsetneq C, it holds that dmin⁡(A,C∖A)≤dmin⁡(A,C′)d_{\min}(A,C\setminus A)\leq d_{\min}(A,C^{\prime}).

In words, the min-stability property means that for any set AA that is a strict subset of some cluster CC in the optimal clustering, the closest point to AA is a point from C∖AC\setminus A, and not from some other cluster. The next two lemmas lie at the heart of our algorithm.

A clustering instance in which centers must be data points that satisfies α\alpha-center proximity for α≥3\alpha\geq 3 (for a center-based clustering objective), also satisfies the min-stability property.

Let Ci∗,Cj∗C^{*}_{i},C^{*}_{j} be any two clusters in the target clustering. Let AA and A′A^{\prime} be any two subsets s.t. A⊊Ci∗A\subsetneq C^{*}_{i} and A′⊆Cj∗A^{\prime}\subseteq C^{*}_{j}. Let p∈Ap\in A and p′∈A′p^{\prime}\in A^{\prime} be the two points which obtain the minimum distance dmin⁡(A,A′)d_{\min}(A,A^{\prime}). Let q∈Ci∗∖Aq\in C^{*}_{i}\setminus A be the nearest point to pp. Also, denote by ci∗c^{*}_{i} and cj∗c^{*}_{j} the centers of clusters Ci∗C^{*}_{i} and Cj∗C^{*}_{j} respectively.

For the sake of contradiction, assume that dmin⁡(A,Ci∗∖A)≥dmin⁡(A,A′)d_{\min}(A,C^{*}_{i}\setminus A)\geq d_{\min}(A,A^{\prime}). Suppose ci∗∉Ac^{*}_{i}\notin A. This means that d(p,p′)=dmin⁡(A,A′)≤dmin⁡(A,Ci∗∖A)≤d(p,ci∗)d(p,p^{\prime})=d_{\min}(A,A^{\prime})\leq d_{\min}(A,C^{*}_{i}\setminus A)\leq d(p,c^{*}_{i}). As α≥3\alpha\geq 3, this contradicts Corollary 2.3.

Thus we may assume ci∗∈Ac^{*}_{i}\in A. It follows that d(q,ci∗)≥d(p,p′)>(3−1)d(p,ci∗)=2d(p,ci∗)d(q,c^{*}_{i})\geq d(p,p^{\prime})>(3-1)d(p,c^{*}_{i})=2d(p,c^{*}_{i}), so d(p,ci∗)<d(q,ci∗)/2d(p,c^{*}_{i})<d(q,c^{*}_{i})/2. We therefore have that d(p′,ci∗)≤d(p,p′)+d(p,ci∗)≤3d(q,ci∗)/2d(p^{\prime},c^{*}_{i})\leq d(p,p^{\prime})+d(p,c^{*}_{i})\leq 3d(q,c^{*}_{i})/2. This implies that d(p′,cj∗)d(p^{\prime},c^{*}_{j}) << d(p′,ci∗)/αd(p^{\prime},c^{*}_{i})/\alpha << d(q,ci∗)/2d(q,c^{*}_{i})/2, and thus d(q,cj∗)≤d(q,ci∗)+d(ci∗,p)+d(p,p′)+d(p′,cj∗)<3d(q,ci∗)≤αd(q,ci∗)d(q,c^{*}_{j})\leq d(q,c^{*}_{i})+d(c^{*}_{i},p)+d(p,p^{\prime})+d(p^{\prime},c^{*}_{j})<3d(q,c^{*}_{i})\leq\alpha d(q,c^{*}_{i}). This contradicts Fact 2.2. ∎

A clustering instance in which centers need not be data points that satisfies α\alpha-center proximity for α≥2+3\alpha\geq 2+\sqrt{3} (for a center-based clustering objective), also satisfies the min-stability property.

As in the proof of Lemma 2.5, let Ci∗,Cj∗C^{*}_{i},C^{*}_{j} be any two clusters in the target clustering and let AA and A′A^{\prime} be any two subsets s.t. A⊊Ci∗A\subsetneq C^{*}_{i} and A′⊆Cj∗A^{\prime}\subseteq C^{*}_{j}. Let p∈Ap\in A and p′∈A′p^{\prime}\in A^{\prime} be the two points which obtain the minimum distance dmin⁡(A,A′)d_{\min}(A,A^{\prime}) and let q∈Ci∗∖Aq\in C^{*}_{i}\setminus A be the nearest point to pp. Also, as in the proof of Lemma 2.5, let ci∗c^{*}_{i} and cj∗c^{*}_{j} denote the centers of clusters Ci∗C^{*}_{i} and Cj∗C^{*}_{j} respectively (though these need not be datapoints).

By definition of center-proximity, we have the following inequalities:

Multiplying the first inequality by 1−1α+1−1α−11-\frac{1}{\alpha+1}-\frac{1}{\alpha-1}, the second by 1α+1\frac{1}{\alpha+1}, the third by 1α−1\frac{1}{\alpha-1}, and summing them together we get

which for α=2+3\alpha=2+\sqrt{3} implies d(p,p′)>d(q,p)d(p,p^{\prime})>d(q,p) as desired. ∎

2 The Algorithm

As mentioned, Balcan et al proved (Theorem 22) that if an instance satisfies min-stability, then the tree on clusters produced by the single-linkage algorithm contains the optimal clustering as some kk-pruning of it. I.e., the tree produced by starting with nn clusters of size 11 (viewed as leaves), and at each step merging the two clusters CC,C′C^{\prime} minimizing dmin⁡(C,C′)d_{\min}(C,C^{\prime}) (viewing the merged cluster as their parent) until only one cluster remains. Given the structural results proven above, our algorithm (see Figure 1) simply uses this clustering tree and finds the best kk-pruning using dynamic programming.

By Lemmas 2.5 and 2.6, the data satisfies the min-stability property, which as shown in is sufficient to guarantee that some pruning of the single-linkage hierarchy is the target clustering. We then find the optimal clustering using dynamic programming by examining kk-partitions laminar with the single-linkage clustering tree. The optimal kk-clustering of a tree-node is either the entire subtree as one cluster (if k=1k=1), or the minimum over all choices of k1k_{1}-clusters over its left subtree and k2k_{2}-clusters over its right subtree (if k>1k>1). Here k1,k2k_{1},k_{2} are positive integers, such that k1+k2=kk_{1}+k_{2}=k. Therefore, we just traverse the tree bottom-up, recursively solving the clustering problem for each tree-node. By assumption that the clustering objective is separable, so each step including the base-case can be performed in polynomial time. For the case of kk-median in a finite metric, for example, one can maintain a n×O(n)n\times O(n) table for all possible centers and all possible clusters in the tree, yielding a running time of O(n2+nk2)O(n^{2}+nk^{2}). For the case of kk-means in Euclidean space, one can compute the cost of a single cluster by computing the center as just the average of all its points. In general, the overall running time is O(n(k2+T(n)))O(n(k^{2}+T(n))), where T(n)T(n) denotes the time it takes to compute the cost of a single cluster. ∎

3 Some Natural Barriers

We complete this section with a discussion of barriers of our approach. First, our algorithm indeed fails on some finite metrics that are (3−ϵ)(3-\epsilon)-perturbation resilient. For example, consider the instance shown in Figure 2. In this instance, the clustering tree produced by single-linkage is not laminar with the optimal kk-median clustering. It is easy to check that this instance is resilient to α\alpha-perturbations for any α<3\alpha<3.

Second, observe that our analysis, though emanating from perturbation resilience, only uses center proximity. We next show that for general metrics, one cannot hope to solve (in poly-time) kk-median instances satisfying α\alpha-center proximity for α<3\alpha<3. This is close to our upper bound of 2+32+\sqrt{3} for general metrics.

For any α<3\alpha<3, the problem of solving kk-median instances over general metrics that satisfy α\alpha-center proximity is NP-hard.

The proof of Theorem 2.7 follows from the classical reduction of Max-kk-Coverage to kk-median. In this reduction, we create a bipartite graph where the right-hand side vertices represent the elements in the ground set; the left-hand side vertices represent the given subsets; and the distance between the set-vertex and each element-vertex is 11, if the set contains that element. Using shortest-path distances, it follows that the distance from any element-vertex to a set-vertex to which it does not belong to is at least 33. Using the fact that the NP-hardness results for Max-kk-Coverage holds for disjoint sets (i.e. the optimal solution of Yes-instances is composed of kk disjoint sets, see ), the α\alpha-center proximity property follows. ∎

Lastly, we comment that using Single-Linkage in the usual way (namely, stopping when there are kk clusters remaining) is not sufficient to produce a good clustering. We demonstrate this using the example shown in Figure 3. Observe, in this instance, since CC contains significantly less points than AA,BB, or DD, this instance is stable – even if we perturb distances by a factor of 33, the cost of any alternative clustering is higher than the cost of the optimal solution. However, because d(A,C)>d(B,D)d(A,C)>d(B,D), it follows that the usual version of Single-Linkage will unite BB and DD, and only then AA and CC. Hence, if we stop the Single-Linkage algorithm at k=3k=3 clusters, we will not get the desired clustering.

Open Problems

There are several natural open questions left by this work. First, can one reduce the perturbation factor α\alpha needed for efficient clustering? As mentioned earlier, recently Balcan et al. (M.F. Balcan, personal communication) have given a very interesting algorithm that reduces the α=3\alpha=3 factor needed by our algorithm for finite metrics to 1+21+\sqrt{2}. Can one go farther, perhaps by using further implications of perturbation-resilience beyond center-proximity? Alternatively, if one cannot find the optimal clustering for small values of α\alpha, can one still find a near-optimal clustering, of approximation ratio better than what is possible on worst-case instances?

In a different direction, one can also consider relaxations of the perturbation-resilience condition. For example, Balcan et al. (personal communication) also consider instances that are “mostly resilient” to α\alpha-perturbations: under any α\alpha-perturbation of the underlying metric, no more than a δ\delta-fraction of the points get mislabeled under the optimal solution. For sufficiently large constant α\alpha and sufficiently small constant δ\delta, they present algorithms that get good approximations to the objective under this condition. A different kind of relaxation would be to consider a notion of resilience to perturbations on average: a clustering instance whose optimal clustering is likely not to change, assuming the perturbation is random from some suitable distribution. Can this weaker notion be used to still achieve positive guarantees?

References