




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





Version: 0.
no guarantees that there are no mistakes or typos. A better version would be released in the near future.
Consider the problem of unsupervised learning. We are given a set of examples, and we would like to parti- tion them into classes of similar examples. For example, given a webpage X about “The reality dysfunction”, one would like to find all webpages on this topic (or closely related topics). The hope is that all such webpages of interest would be in the same cluster as X. The input is a set of examples, usually interpeted as points in high dimensions. For example, given a webpage W, we represent it as a point in high dimensions, by setting the ith coordinate to 1 if the word wi appears somewhere in the document, and say we have a list of 10, 000 words that we care about. Thus, the webpage W can be interpeted as a point of the { 0 , 1 }^10 ,^000 hypercube; namely, a point in 10, 000 dimensions. Let X be the resulting set of n points in d dimensions. To be able to partition points into similar clusters, we need to define a notion of similarity. Such a simi- larity measure can be any distance function between points. For example, consider the “regular” Euclidean distance between points, where
d(p, q) =
∑d
i= 1
(pi − qi)^2 ,
where p = (p 1 ,... , pd) and q = (q 1 ,... , qd). As another motivating example, consider the facility location problem. We are given a set X of n cities and distances between them, and we would like to locate locate k hospitals, so that the maximum distance of a city from its closest hospital is minimized. Intuitively, what we are interested in is selecting good representatives for the input point-set X. Namely, we would like to find k points in X such that they represent X “well”. Formally, consider a subset S of k points of X, and a p a point of X. The distance of p from the set S is
d(p, S ) = min q∈S d(p, q);
namely, d(p, S ) is the minimum distance of a point of S to p. If we interpret S as a set of centers then d(p, S ) is the distance of p to its closest center.
Now, the price of clustering X by the set S is
ν(X, S ) = max p∈X d(p, S ).
This is the maximum distance of a point of X from its closest center in S. It is somewhat illuminating to consider the problem in the plane. We have a set X of n points in the plane, we would like to find find k smallest discs centered at input points, such that they cover all the points of P. Consider the example on the right.
r
Figure 1: The marked point is the bottleneck point.
In this example, assume that we would like to cover it by 3 disks. One possible solution is being shown in Figure 1. The quality of the solution is the radius r of the largest disk. As such, the clustering problem here can be interpeted as the problem of computing an opti- mal cover of the input point set by k discs/balls of minimum radius. This is known as the k-center problem. It is known that k-center clustering is NP-H, even to approxi- mate within a factor of (roughly) 1.8. Interestingly, there is a simple and elegant 2-approximation algorithm. Namely, one can compute in polynomial time, k centers, that induces ball of radius at most twice the optimal radius. Here is the formal definition of the k-center clustering problem. Problem: k- Instance: A set P a of n points, a distance function d(p, q) with triangle inequality holding for it, and a parameter k. Output: A subset S that realizes ropt(P, k) = min S ⊆P,|S |=k d(S , P), where d(S , P) = maxx∈X d(S , x) and d(S , x) = mins∈S d(s, x).
r
To come up with the idea behind the algorithm, imagine that we al- ready have a solution with m = 3 centers. We would like to pick the next m + 1 center. Inspecting the examples above, one realizes that the solution is being determined by a bottleneck point; see Figure 1. That is, there is a single point which determine the quality of the clustering. As such, the natural step is to find a new center that would better serve this bottleneck point. And, whiat can be a better service for this point, than make it the next center? (The resulting clustering using the new center for the example is depicted on the right.) Namely, we always pick the bottleneck point, which is furthest away for the current set of centers, as the next center to be added to the solution.
Subset Sum is (of course) NP-Complete. It can be solved in polynomial time if the xi are small. Let xi ≤ M for all i. Then t ≤ Mn.
SolveSubsetSum(X, t, M) b[0... Mn] - boolean array initialized to FALSE. // Where b[i] is true if it can be achieved by a subset of X. b[0] ← T rue. For i = 1... n do For j = Mn down to xi do b[ j] ← B[ j − xi] ∨ B[ j] return B[t].
Running time: O(Mn^2 )
Q: What to do if want to solve this problem faster? A: First, we turn the problem into an optimization problem.
Definition 2.1 (Subset Sum Optimization Ver.) For an instance of Subset Sum (X, t), the optimal solution, denoted by opt is the largest number one can get as a subset sum which is smaller or equal to t.
Find a subset of X such that it sum is smaller than t but very close to t. Formally,
Approx Subset Sum X = {x 1 ,... , xn} - a set of n integer positive numbers t - target number - approximation parameter Q: Find a subset S ⊆ X s.t. (1 − )t ≤
s∈S s^ ≤^ t, assuming that there is a subset that sums to t.
Q: How to solve this efficiently?
Lemma 2.2 If there is a subset sum that adds up to t one can find a subset sum that adds up to at least t/ 2 in O(n log n) time.
Proof: Add the numbers from largest to smallest. Clearly, we must reach a sum which is at least t/2.
3 An -approximation algorithms
Definition 3.1 For a maximization problem PROB, an algorithm A(I, ) (i.e., A receives as input an instance of PROB, and an approximation parameter > 0) is a polynomial time approximation scheme (PTAS) if for any instance I we have (1−)|Opt(I)| ≤ |A(I, )| ≤ |Opt(I)|, where |Opt(I)| denote the price of the optimal solution for I, and |A(I, )| denotes the price of the solution outputted by A. Furthermore, the running time of the algorithm is polynomial in n (the input size). For a minimization problem, the condition is that |Opt(I)| ≤ |A(I, )| ≤ (1 + )|Opt(I)|.
Example 3.2 An approximation algorithm with running time O(n^1 /^ ) is a PTAS, while an algorithm with running time O(1/n) is not.
Definition 3.3 An approximation algorithm is fully polynomial time approximation scheme (FPTAS) if it is a PTAS, and its running time is polynomial both in n and 1/.
Example 3.4 A PTAS with running time O(n^1 /^ ) is not a FPTAS, while a PTAS with running time O(n^2 /^3 ) is a FPTAS.
4 Approximating subset-sum
S = {a 1 ,... , an} and a number x let x + S = {a 1 + x, a 2 + x,... an + x}
ExactSubsetSum(S ,t) n ← |S | L 0 ← { 0 } For i = 1... n do Li ← Li− 1 ∪ (Li− 1 + xi) Remove from Li all elements larger than t Return largest element in Ln
Definition 4.1 For two positive real numbers z ≤ y, the number y is a δ-approximation to z if (^1) +yδ ≤ z ≤ y.
If we want to approximate the exact subset sum, we can remove from the lists we create close numbers. Namely, Trim(L′, δ) L ←Sorted L: L =< y 1... ym >- numbers in sorted order. curr ← y 1 Lout ← {y 1 } For i = 2... m do If yi > curr · (1 + δ) Append yi to Lout curr ← yi
return Lout
ApproxSubsetSum(S ,t) //Assume S is n sorted numbers: // x 1 ≤ x 2 ≤... ≤ xn n ← |S | L 0 ← { 0 } For i = 1... n do Ei ← Li− 1 ∪ (Li− 1 + xi) δ = / 2 n Li ← T rim(Ei, δ) Remove from Li all elements larger than t Return largest element in Ln
Observation 4.2 If x ∈ Ei then there exists a number y ∈ Li such that y ≤ x ≤ y(1 + δ), where δ = / 2 n.
Theorem 4.3 ApproxSubsetSum returns a number u ≤ t, such that opt/(1 + ) ≤ u ≤ opt ≤ t, where opt is the optimal solution. The running time is O((n^3 /) ln n).
Proof: Let Ei be the list generated by the algorithm. Let Pi be the list of numbers without any trimming (i.e., the set generated by the exact algorithm.).
One can show, using induction, that for any x ∈ Pi there exists y ∈ Li such that
y ≤ x ≤ (1 + δ)iy.
Here is a more involved argument: Li− 1 + xi is a set of numbers between xi and ixi because xi larger than x 1... xi− 1. As such, the number of different values in this range, after trimming is at most
log 1 +δ ixi xi
ln i δ
ln n δ
Thus,
|Li| ≤ |Li− 1 | + O((ln n)/δ).
|Li| ≤ |Li− 1 | + O
n ln n
Finally,
|Ln| = O
n^2 ln n
Thus, the total running time of the algorithm is O(|Ln|n) = O
( (^) n 3 ln^ n
5 Bin Packing
Min Bin Packing. a 1... an - n numbers in [0, 1]. Q: What is the minimum number of unit bins do you need to use to store all the numbers in S?
Bin packing is NPC. Why? A:??? How to do approximation? A: Do next fit. Namely, put number in current bin if that bin can contain it. If the current bin can not contain it, create a new bin and put the number in this bin. Clearly, we need at least
dAe bins where A =
∑^ n
i= 1
ai
Every two consecutive bins contain numbers that add up to more than 1 (Why?). As such, the number of bins used is 2 bAc .Thus, this is a 2 approximation. A better strategy, is to sort the number from largest to smallest and insert them in this order, where in each stage, we scan all current bins, and see if can insert the current number into one of those bins. If we can not, we can create a new bin for this number.
Theorem 5.1 Decreasing first fit is a 1. 5 -approximation to Min Bin Packing.
6 Bibliographical notes
One can do 2-approximation for the k-center clustering in constant dimension in Θ(n log k) time [FG88]. In fact, it can be solve in linear time in this case [Har04].
References
[FG88] T. Feder and D. H. Greene. Optimal algorithms for approximate clustering. In Proc. 20th Annu. ACM Sympos. Theory Comput., pages 434–444, 1988.
[Har04] S. Har-Peled. Clustering motion. Discrete Comput. Geom., 31(4):545–565, 2004.