CMU Randomized Algorithms
Randomized Algorithms, Carnegie Mellon: Spring 2011
Lecture #17: Dimension Reduction
Today we’ll talk about dimensionality reduction, and some related topics in data streaming.
1. Dimension Reduction
Suppose we are given a set of points in . How small can we make and still maintain the Euclidean distances between the points? Clearly, we can always make , since any set of points lies on a -dimensional subspace. And this is (existentially) tight: e.g., the case when are all orthogonal vectors.
But what if we were OK with the distances being approximately preserved? In HW#3, you saw that while there could only be orthogonal unit vectors in , there could be as many as unit vectors which are -orthogonal—i.e., whose mutual inner products all lie in . Near-orthogonality allows us to pack exponentially more vectors!
Put another way, note that
And hence the squared Euclidean distance between any pair of the points defined by these -orthogonal vectors falls in . So, if we wanted points exactly at unit (Euclidean) distance from each other, we would need dimensions. (Think of a triangle in -dims.) But if we wanted to pack in points which were at distance from each other, we could pack them into
dimensions.
1.1. The Johnson Lindenstrauss lemma
The Johnson Lindenstrauss “flattening” lemma says that such a claim is true not just for equidistant points, but for any set of points in Euclidean space:
Lemma 1 Let . Given any set of points in , there exists a map with such that
Note that the target dimension is independent of the original dimension , and depends only on the number of points and the accuracy parameter .
This lemma is tight up to the constant term: it is easy to see that we need at least using a packing argument. Noga Alon showed a lower bound of .
1.2. The construction
The JL lemma is pretty surprising, but the construction of the map is perhaps even more surprising: it is a super-simple random construction. Let be a matrix, such that every entry of is filled with an i.i.d. draw from a standard normal distribution (a.k.a. the “Gaussian” distribution). For , define
That’s it. You hit the vector with a Gaussian matrix , and scale it down by . That’s the map . Note that it is a linear map: . So suppose we could show the following lemma:
Lemma 2 Let . If is constructed as above with , and is a unit vector, then
Then we’d get a proof of Lemma 1. Indeed, set , and hence . Now for each we get that the squared length of is maintained to within with probability at least . By a union bound, all pairs of distances in are maintained with probability at least . This proves Lemma 1.
A few comments about this construction:
- The above proof shows not only the existence of a good map, we also get that a random map as above works with constant probability! In other words, a Monte-Carlo randomized algorithm for dimension reduction. (Since we can efficiently check that the distances are preserved to within the prescribed bounds, we can convert this into a Las Vegas algorithm.)
- The algorithm (at least the Monte Carlo version) does not even look at the set of points : it works for any set with high probability. Hence, we can pick this map before the points in arrive.
- Given a set , one can get deterministic poly-time algorithms constructing a dimension reduction map for : the first one was given in this paper of Lars Engebretsen, Piotr Indyk and Ryan O’Donnell; another construction is due to D. Sivakumar.
A SODA 2011 paper of T.S. Jayram and David Woodruff shows that this dependence of is the best possible. Note that if we use this approach the union bound to prove JL, then is the best bound possible. (An earlier version of these notes incorrectly claimed that the Jayram-Woodruff paper also showed an unconditional lower bound for JL, thanks to Jelani for pointing out the mistake.)
1.3. The proof
Now, on to the proof of Lemma 2. Here’s the main idea. Imagine that the vector we’re considering is just the elementary unit vector . Then is just a vector with independent and identical Gaussian values, and we’re interested in its length—the sum of squares of these Gaussians. If these were bounded r.v.s, we’d be done—but they are not. However, their tails are very small, so things should work out
But what’s a Gaussian ? Well, it looks like this:
\vspace{1in}
Which is not too different from this (bounded) random variable, if you squint a bit:
\vspace{1in}
Which has constant mean. So, if we take a sum of a bunch of such random variables (actually of their squares), it should behave pretty much like its mean (which is ), because of a Chernoff-like argument. And so the expected length is close to , which explains the division by .
Now we just need to make all this precise, and remove the assumption that the vector was just . That’s what the rest of the formal proof does: it has a few steps, but each of them is fairly elementary.
1.4. The proof, this time for real
We’ll be using basic facts about Gaussians, let’s just recall them. The probability density function for the Gaussian is
We also use the following; the proof just needs some elbow grease.
Recall that we want to argue about the squared length of . To start off, observe that each coordinate of the vector behaves like
where the ‘s are i.i.d. r.v.s. But then the proposition tells us that . And since is a unit length vector, this is simply . So, each of the coordinates of behaves just like an independent Gaussian!
What is the squared length of , then? It is
where each , independent of the others. And since , we get .
Now to show that does not deviate too much from . And is the sum of a bunch of independent and identical random variables. If only the ‘s were all bounded, we could have used a Chernoff bound and be done. But these are not bounded, so this is finally where we’ll need to do a little work. (Note: we could take the easy way out, observe that the squares of Gaussians are chi-squared r.v.s, the sum of of them is chi-squared with degrees of freedom, and the internets conveniently has tail bounds for these things. But we digress.)
So let’s start down the ye olde Chernoff path, for the upper tail, say: \Pr[ Z \geq 1 + \varepsilon ] &\leq \Pr[ e^{tkZ} \geq e^{tk(1+\varepsilon)} ] \leq E[ e^{tkZ} ]/e^{tk(1+\varepsilon)} = \prod_i \left( E[ e^{tY_i^2} ]/e^{t(1+\varepsilon)} \right) for every . And what is for ? Let’s calculate it: \frac1{\sqrt{2\pi}} \int_y e^{ty^2} e^{-y^2/2} dy &= \frac1{\sqrt{2\pi}} \int_z e^{-z^2/2} \frac{dz}{\sqrt{1 – 2t}} = \frac{1}{\sqrt{1 – 2t}}. for . So our current bound on the upper tail is that for all we have
Let’s just focus on part of this expression:
Plugging this back, we get
if we set and use the fact that for . (Note: this setting of also satisfies , which we needed from our previous calculations.)
Almost done: let’s take stock of the situation. We observed that was distributed like a sum of squares of Gaussians, and using that we proved that
for . A similar calculation bounds the lower tail, and finishes the proof of Lemma 2.
Citations: The JL Lemma was first proved in this paper of Bill Johnson and Joram Lindenstrauss. There have been several proofs after theirs, usually trying to tighten their results, or simplify the algorithm/proof (see citations in some of the newer papers): the proof follows some combinations of the proofs in this STOC ’98 paper of Piotr Indyk and Rajeev Motwani, and this paper by Sanjoy Dasgupta and myself.
2. The data stream model
The JL map we considered was a linear map, and that has many advantages. One of them is that we can use it in a distributed context: if players each have a vector and each knows the JL matrix , then to compute each person can just compute , send their answers out, and then someone can sum up the answers to get . Since these vectors are smaller than (they lie in instead of ), this can result in significant savings in communication. (We need all players to know the matrix , but if they have shared randomness they can generate this matrix themselves.)
This same idea is useful in the context of data streaming: suppose you have a data stream of a large number of elements whizzing past you, each element drawn from the universe . This stream defines a frequency vector , where is the number of times element is seen. People working on data streams want to calculate statistics of this vector —e.g., how many non-zeroes does it have? What is the length of this? (Duh! it’s just the length of the data stream.) What is ? Etc.
The Space Crunch. All this can be trivially done if we use space to actually store the vector . Suppose we do not want to store the frequency vector explicitly, but are OK with approximate answers. We can use JL or similar schemes to approximately calculate . Suppose is a random Gaussian matrix, then by the guarantee of the JL lemma, the estimate with probability , if . (Note: this is the error for a single query—so we’re not guaranteeing the counts at all times are close, just at the time the query is made.)
And the algorithm is simple: maintain a vector , initially zero. When the element comes by, add in the column of to . Finally, answer with . (If you have to answer queries, choose appropriately larger.)
Of course, you’ve realized I am cheating. In order to save space we used JL. But the JL matrix itself uses entries, which is a lot of space, much more than the entries of the frequency vector ! Also, we now need to maintain a matrix of reals, whereas just has integers!
We can handle both issues. The former issue can directly be handled by using a pseudorandom generator that “fools” low-space computation—we will not talk about this solution in this lecture. Instead we’ll give a different (though weaker) solution which handles both issues: it will use less space, and will maintain only integer values (if the input has integers).
3. Using random signs instead of Gaussians
While Gaussians have all kinds of nice properties, they are real-valued distributions and hence require attention to precision. How about populating with draws from other, simpler distributions? How about setting each , and letting ? (A random sign is also called a Rademacher random variables, btw, the name Bernoulli being already taken for a random bit in .)
Now, we want to study the properties of
To keep subscripts to a minimum, consider the inner expression
where each . Then
if the ‘s are pairwise independent, since and by independence. Plugging this into~(1) and recalling that , we get
Just what we like! To show that is indeed close to its mean, we will use Chebyshev, and this requires us to compute the variance of .
If the rows of are independent, then is the sum of the variances from each row, which in terms of the variable defined above is:
But , we know what is. For the other term,
(The other terms disappear because of -wise independence.) And plugging this into the definition of , we get
Interesting, the variance is just twice the squared mean—that’s good, since the variance of (which was the final answer, obtained by taking the average of such variables) is as much, since averaging reduces the variance. So . And finally, we can set and use Chebyshev to get
Great! So, if we take a matrix whose rows were independent, each row having values drawn from a -wise independent sample space. We maintain a -dimensional vector , and whenever an element in comes by in the stream, we just add in the column of to . And when we want the answer, we reply with —this will be correct with probability at least .
Why -wise independence? Well, the calculation of only used the fact that any four entries of each row behaved independently of each other. And it is possible to generate values from which is -wise independent, using hash functions that require only bits of space. (We’ll talk more about this later in the course.) So the total space usage is: bits to store the hash functions, to store vector if the frequency of each element is at most , and that’s it.
Citations: This scheme is due to the Gödel prize winning paper of Noga Alon, Yossi Matias, and Mario Szegedy. There has been a lot of interesting work on moment estimation: see, e.g., this STOC 2011 paper of Daniel Kane, Jelani Nelson, Ely Porat and David Woodruff on getting lower bounds for -norms of the vector , and the many references therein.
4. Subgaussian Behavior
In the previous section, we saw that if each row of the matrix was drawn from a -wise independent sample space (and hence generating any column of could be done in space), setting would suffice to give answers within with probability at least . Note that the number of rows went from to ; this increase typical of cases where we only use the second moment (and limited independence) instead of all the moments (complete independence).
So suppose we did have the luxury of full independence, could we match the JL bound using Rademacher matrices? Or does moving to the case already lose something in the performance? It turns out we can also prove Lemma 2 for a Rademacher matrix, losing only constants—we’ll now prove this.
Let’s look over the proof in Section 1, and see what we need to do. We take an arbitrary unit vector , and define
for , and ‘s being i.i.d and . If we could show that
- , and
- for some constant ,
then the rest of the proof of Section 1 does not use any other facts about Gaussians. And the first fact follows by the calculations from the previous section, so all we need to do is to bound the moment generating function for !
We can do this by explicit calculations, but instead let’s give a useful abstraction:
Definition 4 A random variable is said to be subgaussian with parameter and for all real , we have .
(You can define subgaussian-ness alternatively as in these notes by Roman Vershynin, which also shows the two definitions are equivalent for symmetric distributions.) A simple calculation shows that for then —good to know that the Gaussian is also subgaussian!
The following lemma gives a slick way to bound the mgf for the square of a subgaussian, now that we’ve done the hard work for the Gaussians.
Proof: Well, suppose is an independent Gaussian, then
by the calculation we just did for Gaussians. (Note that we’ve just introduced a Gaussian into the mix, without any provocation! But it will all work out.) Let just rewrite that
Using the -subgaussian behavior of we bound this by
Finally, the calculation~(1) gives this to be .
Good. Now if were subgaussian, we’d be done. We know that is a weighted sum of Rademacher varaibles. A Rademacher random variable is indeed -subgaussian
And if ‘s are independent and -subgaussian, and , then has
To summarize: ‘s are -subgaussian, so is too. And hence for -random variables as well. This, in turn, completes the proof that the Rademacher matrix also has the JL property! Note that the JL matrix now just requires us to pick random bits (instead of random Gaussians); also, there are fewer precision issues to worry about. One can consider other distributions to stick into the matrix —all you need to show is that has the right mean, and that the entries are subgaussian.
Citations: The scheme of using Rademacher matrices instead of Gaussian matrices for JL was first proposed in this paper by Dimitris Achlioptas. The idea of extending it to subgaussian distributions appears in this paper of Indyk and Naor, and this paper of Matousek. The paper of Klartag and Mendelson generalizes this even further.
BTW, one can define subgaussian distributions as ones that satisfy only for , or as variables for which for (the upper tail is subgaussian), and prove JL bounds—see, e.g., the paper of Matousek—but it does not matter for distributions symmetric about with bounded variance, since these definitions are then essentially the same.
Fast J-L: Do we really need to plug in non-zero values into every entry of the matrix ? What if most of is filled with zeroes? The first problem is that if is a very sparse vector, then might be zero with high probability? Achlioptas showed that having a random two-thirds of the entries of being zero still works fine: the paper of Nir Ailon and Bernard Chazelle showed that if you first hit with a suitable matrix which caused to be “well-spread-out” whp, and then would still hold for a much sparser . Moreover, this requires much less randomless, and furthermore, the computations can be done faster too! There has been much work on fast and sparse versions of JL: see, e.g., this SODA 11 paper of Ailon and Edo Liberty, and this arxiv preprint by Daniel Kane and Jelani Nelson. Jelani has some notes on the Fast JL Transform.
Compressed Sensing: Finally, the J-L lemma is closely related to compressed sensing: how to reconstruct a sparse signal using very few measurements. See these notes by Jiri Matousek, or these by Baraniuk and others for a proof of the beautiful connection. I will say more about this connection in a later post.
Lecture #16: Odds and ends
Some examples for the CKR decomposition scheme
Varun asked why the CKR algorithm differs in so many ways from Bartal’s procedure:
- it chooses a single radius instead of choosing an independent radius for each piece it carves out,
- it chooses the radius from a uniform distribution,
- it picks the next vertex randomly (instead of arbitrarily), and moreover,
- it also grows regions from vertices that have been captured in previously carved out pieces.
Here are some examples that might clarify the situation:
Suppose we choose a random radius R uniformly from [r/4,r/2], but independently for each center. Then in the following example, each time a leaf is picked, the unit-length edge (u,v) will be cut with probability 2/r. If there are n leaves, the edge will be cut with probability about Theta(n/r) >> O(log n)/r.
Now, suppose we choose a single radius R uniformly from [r/4,r/2], but choose the centers in arbitrary (adversarial) order. In the following example, if we choose the centers in the order l_{r/2-1}, …, l_2, l_1, then we cut the edge (u,v) for sure (with probability 1). Note that in this case, the random order means there’s a good chance that early on in the process, we pick some vertex l_i with some small value of $i$. Since this leaf is close to the edge (u,v), it will put both u and v in the same set.
So yeah, once we go with a uniformly random choice of R (instead of choosing it from a geometric distribution), we run into trouble if we re-sample R independently each time time we grow a region, or if we choose the next vertex to grow from in an worst-case fashion.
Finally, what about the growing balls from centers that have already been carved out? That is important for the analysis, because it makes the process depend very mildly on the past evolution. Would the algorithm break down if we did not do that? I am blanking on a bad example right now, but I think there should be one. Let me know if you see it.
Some citations for k-server
In STOC 2008, Cote, Meyerson, and Poplawski gave a randomized algorithm for the k-server problem on certain special kinds of HSTs that achieved a poly-logarithmic competitive ratio. In SODA 2009, Bansal, Buchbinder, and Naor abstracted out certain “convexity” properties, which if we could prove, would give a polylogarithmic competitive ratio for general HSTs, and hence for all metric spaces using the Theorems we saw in class. (See also their ICALP 2009 paper.) It’d be great to make progress on this problem.
Lecture #16: Distance-preserving trees (part II)
1. Embeddings into Distributions over Trees
In this section, we prove the following theorem using tree embeddings (and then, in the following section, we improve it further to ).
Theorem 1 Given any metric with and aspect ratio , there exists a efficiently sampleable distribution over spanning trees of such that for all :
- For all , , and
- .
To prove this theorem, we will use the idea of a low diameter decomposition. Given a metric space on points and a parameter , a (randomized) low-diameter decomposition is an efficiently sampleable probability distribution over partitions of into such that
- (Low Radius/Diameter) For all , there exists such that for all , . Hence, for any , .
- (Low Cutting Probability) For each pair , with .
We’ll show how to construct such a decomposition in the next section (next lecture), and use such a decomposition to prove Theorem 1.
Consider the following recursive algorithm, which takes as input a pair where is a set of vertices of diameter at most , and returns a rooted tree .
TreeEmbed:
- Apply the low-diameter decomposition to with the parameter to get the partition .
- Recurse: Let TreeEmbed(). As a base case, when is a single point, simply return that point.
- For every tree with , add the edge with length . This is a new tree which we denote .
- Return the tree/root pair .
Recall that since the low diameter decomposition is randomized, this algorithm defines a distribution over trees over . To build the tree for , we first rescale so that for all , and . We define the distribution as the one obtained by calling TreeEmbed.
Lemma 2 For all , for all .
Proof: Fix and , and let be such that . Consider the invocation of TreeEmbed such that . First, we examine the case in which . By the definition of the low diameter decomposition, since , and will fall into separate parts of the partition obtained in Step 1, and so we will have , the length of the edge placed between different subtrees. In the case in which , then it must be that and have been separated at a higher level of the recursion, are consequently separated by a higher subtree edge, and hence .
Lemma 3 For all ,
Proof: We begin with two easy subclaims. Suppose TreeEmbed:
- Claim 1: for all . By induction, lies in some piece of the partition having diameter at most and hence inductively is at distance at most from its root . That root is connected to the root by an intertree edge of weight , giving us in total.
- Claim 2: If , then . From the previous claim, each and is at distance at most from , distances are symmetric, and the triangle inequality applies.
We now have from the definition:
where the first inequality follows from our subclaims, the second follows from the property of the low diameter decomposition. Setting and completes the proof.
The two lemmas above prove Theorem 1. How do we implement these low diameter decompositions? And how can we get the promised ? Keep reading…
2. Low Diameter Decompositions
Recall the definition of a (randomized) low-diameter decomposition from above: given a metric and a bound , we want a partition with pieces of radius at most , and want vertices to be separated with “small” probability (i.e., proportional to their distance, and inversely proportional to ).
Before we proceed, think about how you’d get such a decomposition for a line metric, or a tree metric, with ; moreover, you cannot hope to get subconstant for even the line. So the theorem says that general graphs lose a factor more, which is not bad at all! (And this factor is existentially optimal, we will show a tight example.)
2.1. Algorithm I: Geometric Region Growing
To make our life easier, we’ll assume that all distances in the metric are at least . (We can enforce this via a pre-processing without much effort, I’ll come back to it.)
The algorithm just picks a “truncated” geometric distance , carves out a piece of radius around some vertex, and repeats until the metric is eaten up.
Geom-Regions:
- Choose ; if , then set .
- Pick an arbitrary vertex , and set .
- Return Geom-Regions.
Clearly, the radius bound is maintained by the fact that with probability .
What’s the chance that lie in separate parts? So let’s view this process as picking a vertex and starting with a ball of radius zero around it; then we flip a coin with bias , increasing the radius by one after each tails, until either we see a heads or we reach tails, when we cut out the piece. And then we pick another vertex, and repeat the process.
Consider the first time when one of these lies in the current ball. Note that either this ball will eventually contain both of them, or will separate them. And to separate them, it must make a cut within the next steps. The chance of this is at most the chance of seeing a heads from a bias- coin in steps, plus the chance that a r.v. sees more than tails in a row. Using a naive union bound for the former, we get
We now use the fact that all distances are at least to claim that and hence the probability of separated is at most , which proves the second property of the decomposition.
Finally, the loose ends: to enforce the minimum-distance condition that , just think of the metric as a complete graph with edge-lengths , contract all edges with , and recompute edge lengths to get the new metric . Running the decomposition Geom-Regions on this shrunk metric, and then unshrinking the edges, will ensure that each pair is separated with probability either (if it has length ), or probability at most . And finally, since the output had radius at most according to , any path has at most nodes and its length can change by at most for , the new radius is at most !.
Another advantage of this shrinking preprocessing: a pair is separated only when , and it is separated for sure when . Using this observation in the calculation from the previous section can change the to just . But to get the ultimate guarantee, we’ll need a different decomposition procedure.
2.2. Algorithm II: The CKR Decomposition
Theorem 4 (The Better Decomposition) There exists an efficiently sampleable probability distribution over partitions with parts having radius at most such that
where .
The procedure for the decomposition is a little less intuitive, but very easy to state:
CKR Decomposition:
- Choose uniformly at random.
- Choose a random permutation uniformly at random.
- Consider the vertices one by one, in the order given by . When we consider , we assign all the yet-unassigned vertices with to ‘s partition.
For example, suppose the ordering given by is . The figure below illustrates the coverage when the vertices are visited by this process.
This construction directly implies the low-radius property, restated in the following claim.
Lemma 5 (Low Radius) The output of the algorithm has the property that for all , there exists such that for all , .
The real work is in showing that for each pair , it is separated with small probability. Before proving this, let us state two definitions useful for the proof. For the analysis only: suppose we re-number the vertices in order of the distance from the closer of .
- (Settling) At some time instant in this procedure, one (or both) of or gets assigned to some . We say that settles the pair .
- (Cutting) At the moment the pair is settled, if only one vertex of this pair is assigned, then we say that cuts the pair .
According to these definitions, each pair is settled at exactly one time instant in the procedure, and it may or may not be cut at that time. Of course, once the pair is settled (with or without being cut), it is never cut in the future.
Now to bound the separation probability. Consider , and let and . Assume (the other case is identical). If cuts when the random values are and , the following two properties must hold:
- The random variable must lie in the interval (else either none or both endpoints of would get marked).
- The node must come before in the permutation .
Suppose not, and one of them came before in the permutation. Since all these vertices are closer to the pair than is, then for the current value of , they would have settled the pair (either capturing one or both of the endpoints) at some previous time point, and hence would not settle—and hence not cut—the pair .
With these two properties, we establish
But we wanted to do better than that! No worries, the fix is easy, but clever. First, note that if then the probability of separating is at most . So suppose . Now, for to cut , it is not enough for and comes before all for . It also must be the case that be at most from the closer of the pair (say ) to even reach one of the vertices, let alone separate then. And at least from the further one (say ) so that some setting of would have a chance to separate the two. So the distance of from must be at most , and at least , and the same for its distance from . If we restrict the harmonic sum in the final expression over just the vertices that satisfy these bounds, we get the bound
and hence the bound in Theorem 4.
Theorem 6 (FRT 2003) Using the decomposition procedure from Theorem 4 in the TreeEmbed algorithm, we get that for all :
The proof for the TreeEmbed algorithm remains essentially unchanged, except for the final calculations:
where the last equality follows from observing that we have a telescoping sum.
Citations: The construction was due to Yair Bartal (1996); this substantially improved on the first non-trivial guarantee of due to Alon, Karp, Peleg and West (1992). The low-diameter decomposition is also from Bartal. The algorithm is by Fakcharoenphol, Rao, and Talwar (2003), based on the improved decomposition scheme due to Calinescu, Karloff and Rabani (2000).
3. Lower Bounds
Let us show two lower bounds: first, that no randomized low-diameter decomposition can achieve better than for general metrics. And that no random tree embeddings can do better than either.
3.1. Lower Bounds for Decompositions
First, given a graph with unit length edges, if we apply a decomposition with parameter to the graph metric , we will cut each edge with probability . The expected number of cut edges will be . So, for each the probabilistic method says there exists a diameter- partition that cuts at most edges.
Let be a graph with nodes and edges (with ), where the girth of the graph (the length of the shortest simple cycle) is at least (for constant ). Such graphs are known to exist, this can be shown by the probabilistic method.
Now, if we set and consider any diameter- partition: we claim no set in this partition can induce a cycle. Indeed, since every cycle is of length , two furthest points in the cycle would be distance from each other. So all sets induce a forest, which means the number of internal edges is at most . This means at least edges are cut.
Cool. For every diameter- partition, at least edges are cut because of the large girth property. But there exists one that cuts at most edges, because we have a good decomposition algorithm. So now we put the two facts together.
3.2. Lower Bounds for Random Tree Embeddings
Suppose there is a distribution that achieves expected stretch for the large-girth graphs above. Let’s use this to obtain a low-diameter decomposition with cutting parameter ; this will mean .
Sample a tree from the distribution, pick an arbitrary vertex , pick a random value . Delete all edges that contain points at distance exactly in from . The remaining forest has components with radius at most , and diameter in the tree. Since distances on the original graph are only smaller, the diameter of each part will only be less in the original graph.
Moreover, given the tree , a pair will be separated with probability at most . Taking expectations, the total probability of separated is at most
So we have a decomposition scheme with parameter . And combining this with the previous lower bound on any decomposition scheme, we get .
Lecture #15: Distance-preserving trees (part I)
1. Metric Spaces
A metric space is a set of points, with a distance function that satisfies for all , symmetry (i.e., ), and the triangle inequality (i.e., for all ). Most of the computer science applications deal with finite metrics, and then denotes the number of points .
There are many popular problems which are defined on metric spaces:
- The Traveling Salesman Problem (TSP): the input is a metric space, and the goal is to find a tour on all the nodes whose total length is as small as possible. This problem is sometimes defined on non-metrics as well, but most of the time we consider the metric version.
The best approximation algorithm for the problem is a -approximation due to Oveis-Gharan, Saberi and Singh (2010). Their paper uses randomization to beat the -approximation of Cristofides (1976), and make progress on this long-standing open problem. The best hardness result for this problem is something like due to Papadimitriou and Vempala.
- The -Center/-Means/-median problems: the input is a metric space , and the goal is to choose some positions from as “facilities”, to minimize some objective function. In -center, we minimize , the largest distance from any client to its closest facility; here, we define the distance from a point to a set as . In -median, we minimize , the total (or equivalently, the average) distance from any client to its closest facility. In -means, we minimize , the average squared distance from any client to its closest facility. (Note: to see why these problems are called what they are, consider what happens for the -means/medians problem on the line.)The best algorithms for -center give us a -approximation, and this is the best possible unless P=NP. The best -median algorithm gives an -approximation, whereas the best hardness known for the version of the problem stated above is unless P=NP. For -means, gap between the best algorithm and hardness results is worse for general metric spaces. For geometric spaces, better algorithms are known for -means/medians.
- The -server problem: this is a classic online problem, where the input is a metric space (given up-front); a sequence of requests arrives online, each request being some point in the metric space. The algorithm maintains servers, one each at some positions in the metric space. When the request arrives, one of the servers must be moved to to serve the request. The cost incurred by the algorithm in this step is the distance moved by the server, and the total cost is the sum of these per-step costs. The goal is to give a strategy that minimizes the total cost of the algorithm.The best algorithm for -server is a -competitive deterministic algorithm due to Koutsoupias and Papadimitriou. Since -server contains paging as a special case (why?), no deterministic algorithm can do better than -competitive. It is a long-standing open problem whether we can do better than CC deterministically—but far more interesting is the question of whether randomization can help beat ; the best lower bound against oblivious adversaries is , again from the paging problem.
1.1. Approximating Metrics by Trees: Attempt I
A special kind of metric space is a tree metric: here we are given a tree where each edge has a length . This defines a metric , where the distance is the length of the (unique) shortest path between and , according to the edge lengths . In general, given any graph with edge lengths, we get a metric .
Tree metrics are especially nice because we can use the graph theoretic idea that it is “generated” by a tree to understand the structure of the metric better, and hence give better algorithms for problems on tree metrics. For instance:
- TSP on tree metrics can be solved exactly: just take an Euler tour of the points in the tree.
- -median can be solved exactly on tree metrics using dynamic programming.
- -server on trees admits a simple -competitive deterministic algorithm.
So if all metrics spaces were well-approximable by trees (e.g., if there were some small factor such that for every metric we could find a tree such that
for every , then we would have an -approximation for TSP and -median, and an -competitive algorithm for -server on all metrics. Sadly, this is not the case: for the metric generated by the cycle graph , the best factor we can get in~(1) is . This is what we would get if we just approximated the tree by a line.
So even for simple metrics like that generated by the cycle (on which we can solve these problems really easily), this approach hits a dead-end really fast. Pity.
1.2. Approximating Metrics by Trees: Attempt II
Here’s where randomization will come to our help: let’s illustrate the idea on a cycle. Suppose we delete a uniformly random edge of the cycle, we get a tree (in fact, a line). Note that the distances in the line are at least those in the cycle.
How much more? For two vertices adjacent in the cycle, the edge still exists in the tree with probability , in which case ; else, with probability , and lie at distance from each other. So the expected distance between the endpoints of an edge of the cycle is
And indeed, this also holds for any pair (check!),
But is this any good for us?
Suppose we wanted to -median on the cycle, and let be the optimal solution. For each , let be the closest facility in to ; hence the cost of the solution is:
By the expected stretch guarantee, we get that
I.e., the expected cost of this solution on the random tree is at most . And hence, if is the cost of the optimal solution on , we get
Great—we know that the optimal solution on the random tree does not cost too much. And we know we can find the optimal solution on trees in poly-time.
Let’s say is the optimal solution for the tree , where the closest facility in to is , giving . How does this solution perform back on the cycle? Well, each distance in the cycle is less than that in the tree , so the expected cost of solution on the cycle will be
And we have a randomized -approximation for -median on the cycle!
1.3. Popping the Stack
To recap, here’s the algorithm: pick a random tree from some nice distribution. Find an optimal solution for the problem, using distances according to the tree , and output this set as the solution for the original metric.
And what did we use to show this was a good solution? That we had a distribution over trees such that
- every tree in the distribution had distances no less than that in the original metric, and
- the expected tree distance between any pair satisfies for some small ; here .
And last but not least
- that the objective function was linear in the distances, and so we could use linearity of expectations.
Note that TSP, -median, -server, and many other metric problems have cost functions that are linear in the distances, so as long as the metrics we care about can be “embedded into random trees” with small , we can translate algorithms on trees for these problems into (randomized) algorithms for general metrics! This approach gets used all the time, and is worth remembering. (BTW, note that this general approach does not work for non-linear objective functions, like -center, or -means.)
But can we get a small in general? In the next section, we show that for any -point metric with aspect ratio , we can get ; and we indicate how to improve this to , which is the best possible!
2. Embeddings into Trees
In this section, we prove the following theorem using tree embeddings (and then, in the following section, we improve it further to ).
Theorem 1 Given any metric with and aspect ratio , there exists a efficiently sampleable distribution over spanning trees of such that for all :
- For all , , and
- .
To prove this theorem, we will use the idea of a low diameter decomposition. Given a metric space on points and a parameter , a (randomized) low-diameter decomposition is an efficiently sampleable probability distribution over partitions of into such that
- (Low Radius/Diameter) For all , there exists such that for all , . Hence, for any , .
- (Low Cutting Probability) For each pair , with .
We’ll show how to construct such a decomposition in the next section (next lecture), and use such a decomposition to prove Theorem 1.
HW #4 Open Thread
Please ask your HW#4 questions here. Here’s one:
For Exercise 2, Part A, the algorithm says to “Choose 2m+1 elements S uniformly at random…”. Does this mean with replacement, or without replacement? In other words, are we choosing 2m+1 elements one at a time, each with equal probability of picking any of the elements from A, such that S might be a multiset? Or, are we choosing a set of 2m+1 elements from A, where each set has probability 1 / binom(n, 2m+1) of being picked?
It does not matter; you can do it either way. Though the analysis for the process where you choose independently with replacement is slightly simpler.
Update: the phrasing for problem #2(b) was ambiguous, and has been fixed. (Thanks Kevin!)
Update #2: the indices in the algorithm in problem #2 were off by 1 and have been fixed. (Thanks Favonia!)
Lecture #14: Game Theory
Today we discussed some key concepts in game theory and connections between (some of) them and results in online learning.
We began by discussing 2-player zero-sum games. The Minimax Theorem states that these games have a well-defined value V such that (a) there exists a mixed strategy p for the row-player that guarantees the row player makes at least V (in expectation) no matter what column the column-player chooses, and (b) there exists a mixed strategy q for the column-player that guarantees the row player makes at most V (in expectation) no matter what row the row-player chooses. We then saw how we could use the results we proved about the Randomized Weighted Majority algorithm to prove this theorem.
We next discussed general-sum games and the notion of Nash equilibria. In a zero-sum game, a Nash equilibrium requires the two players to both be playing minimax optimal strategies, but in general there could be Nash equilibria of multiple quality-levels for each player. We then proved the existence of Nash equilibria. However, unlike in the case of zero-sum games, the proof gives no idea of how to find a Nash equilibrium or even to approach one. In fact, doing so in a 2-player nxn game is known to be PPAD-hard.
Finally we discussed the notion of correlated equilibria and the connection of these to swap-regret, a generalization of the kind of regret notion we discussed last time. In particular, any set of algorithms with swap-regret sublinear in T, when played against each other, will have an empirical distribution of play that approaches (the set of) correlated equilibria. See lecture notes.
HW3 Graders
Hi, if you volunteered to help grade HW3, please send me mail (if you haven’t already done so). Thanks! –Anupam
Lecture #13: Learning Theory II
Today we talked about online learning. We discussed the Weighted Majority and Randomized Weighted Majority algorithms for the problem of “combining expert advice”, showing for instance that the RWM algorithm satisfies the bound , where is the number of “experts” and is the number of mistakes of the best expert in hindsight. Also, this can be used when the experts are not predictors but rather just different options (like whether to play Rock, Paper, or Scissors in the Rock-Paper-Scissors game). In this case, “# mistakes” becomes “total cost” and all costs are scaled to be in the range [0,1] each round.
We then discussed the “multiarmed bandit” problem, which is like the experts problem except you only find out the payoff for the expert you chose and not for those you didn’t choose. For motivation, we discussed this in the context of the problem of selling lemonade to an online series of buyers, where the “experts” correspond to different possible prices you might choose for selling your lemonade. We then went through an analysis of the EXP3 algorithm (though we did a simpler version of the analysis that gets a dependence on in the regret bound rather than the optimal ).
See the lecture notes (2nd half)
Lecture #12: Learning Theory 1
Today we talked about the problem of learning a target function from examples, where examples are drawn from some distribution D, and the goal is to use a labeled sample S (a set of examples drawn from D and labeled by the target f) to produce a function h such that is low. We gave a simple efficient algorithm for learning decision-lists in this setting, a basic “Occam’s razor” bound, and then a more interesting bound using the notion of shatter coefficients and a “ghost sample” argument. See 1st half of these lecture notes.
A few additional comments:
- One way to interpret the basic Occam bound is that in principle, anything you can represent in a polynomial number of bits you can learn from a polynomial number of examples (if running time is not a concern). Also “data compression implies learning”: if you can take a set of m examples and find a prediction rule that is correct on the sample and requires < m/10 bits to write down, then you can be confident it will have low error on future points.
- On the other hand, we would really like to learn from as few examples as possible, which is the reason for wanting bounds based on more powerful notions of the “underlying complexity” of the target function, such as shatter coefficients. Other very interesting bounds are based on a notion called “Rademacher complexity” which is even tighter.
- For more info, see notes for 15-859(B) machine learning theory
Lecture #11: Online algorithms
Today we discussed randomized online algorithms, and in particular, algorithms for the ski-rental (elevator-or-stairs) and paging problems. See lecture notes as well as Chapter 13 of the MR book. Also, Claire Mathieu has a very nice set of notes on the randomized ski-rental problem.