Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

COMS 4771 HW4 (Spring 2022)

1    VC dimension

Compute the tightest possible VC dimension estimate of the following model classes:

(i)  F := {fα  : x 7→ Vi 1[xi  ≤ αi] | α = (αi )i∈{1 , . . . ,d},αi  ∈ R}, for a fixed dimension d ≥ 1.

(ii)  F := Convex polygons in R2 , where the interior (and the boundary) is labelled negative and the exterior is labelled positive.

 

2    From distances to embeddings

Your friend from overseas is visiting you and asks you the geographical locations of popular US cities on a map.  Not having access to a US map, you realize that you cannot provide your friend accurate information. You recall that you have access to the relative distances between nine popular US cities, given by the following distance matrix D :

Distances (D)    BOS

0

206

429

1504

963

2976

3095

2979

1949

Being a machine learning student, you believe that it may be possible to infer the these cities from the distance data. To find an embedding of these nine cities on a two map, you decide to solve it as an optimization problem as follows.


You associate a two-dimensional variable xi as the unknown latitude and the longitude value for each of the nine cities (that is, x1 is the lat/lon value for BOS, x2 is the lat/lon value for NYC, etc.). You write down the an (unconstrained) optimization problem

minimizex1 , . . . ,x9

xi  xj ∥ − Dij  2 ,

i,j

where Pi,j (∥xi − xj ∥ − Dij )2 denotes the embedding discrepancy function.

(i)  What is the derivative of the discrepancy function with respect to a location xi ?

(ii)  Write a program in your preferred language to find an optimal setting of locations x1 , . . . ,x9 .

You must submit your code to receive full credit.

(iii)  Plot the result of the optimization showing the estimated locations of the nine cities. (here is

a sample code to plot the city locations in Matlab)

>>  cities={’BOS’,’NYC’,’DC’,’MIA’,’CHI’,’SEA’,’SF’,’LA’,’DEN’};

>>  locs  =   [x1;x2;x3;x4;x5;x6;x7;x8;x9];

>>  figure;  text(locs(:,1),  locs(:,2),  cities);

What can you say about your result of the estimated locations compared to the actual geo- graphical locations of these cities?

 

3    Studying k-means

Recall that in k-means clustering we attempt to find k cluster centers cj  ∈ Rd ,j ∈ {1, . . . ,k} such that the total (squared) distance between each datapoint and the nearest cluster center is minimized. In other words, we attempt to find c1 , . . . ,ck that minimizes

n

 jin.,k} xi cj 2 ,                                                   (1)

where n is the total number of datapoints. To do so, we iterate between assigning xi to the nearest cluster center and updating each cluster center cj  to the average of all points assigned to the jth cluster (aka Lloyd’s method).

(i)  [it is unclear how to find the best k, i.e. estimate the correct number of clusters!] Instead of holding the number of clusters k fixed, one can think of minimizing (1) over both k and c. Show that this is a bad idea.  Specifically, what is the minimum possible value of (1)?  what values of k and c result in this value?

(ii)  [suboptimality of Lloyds method] For the case d  =  1 (and k  ≥ 2), show that Lloyd’s algorithm is not optimal. That is, there is a suboptimal setting of cluster assignment for some dataset (with d = 1) for which Lloyd’s algorithm will not be able to improve the solution.

(iii)  [improving k-means quality] k-means with Euclidean distance metric assumes that each pair of clusters is linearly separable (see part ii below). This may not be the desired result. A classic example is where we have two clusters corresponding to data points on two concentric circles in the R2 .

(a)  Implement Lloyd’s method for k-means algorithm and show the resulting cluster assign- ment for the dataset depicted above.  Give two more examples of datasets in R2 , for which optimal k-means setting results in an undesirable clustering. Show the resulting cluster assignment for the two additional example datasets.

(b)  Show that for k = 2, for any (distinct) placement of centers c1 and c2 in Rd , the cluster boundary induced by minimizing the k-means objective (i.e. Eq. 1) is necessarily linear.

One way to get a more flexible clustering is to run k-means in a transformed space.  The transformation and clustering is done as follows:

•  Let Gr denote the r-nearest neighbor graph induced on the given dataset (say the dataset has n datapoints), that is, the datapoints are the vertices (notation: vi is the vertex associ- ated with datapoint xi ) and there is an edge between vertex vi and vj if the corresponding datapoint xj is one of the r closest neighbors of datapoint xi .

  Let W denote the n × n edge matrix, where

wij  = 1[edge between vi and vj in Gr ].

•  Define n × n diagonal matrix D as dii  :=    j wij , and finally define L = D − W.

•  Compute the bottom k eigenvectors/values of L (that is, eigenvectors corresponding to the k smallest eigenvalues).  Let V be the n × k matrix of of the bottom eigenvectors. One can view this matrix V as a k dimensional representation of the n datapoints.

  Run k-means on the datamatrix V and return the clustering induced.

We’ll try to gain a better understanding of this transformation V (which is basically the lower order spectra of L).

(c)  Show that for any vector f Rn ,

fT Lf =        wij (fi fj )2 .

ij

(d)  L is a symmetric positive semi-definite matrix.

(e)  Let the graph Gr have k connected components C1 , . . . ,Ck . Show that the n × 1 indica- tor vectors ✶Ck , . . . , ✶Ck   are (unnormalized) eigenvectors of L with eigenvalue 0. (the ith component of an indicator vector takes value one iff the vertex vi is in the connected component)


Part (e) gives us some indication on why the transformation V (low order spectra of L) is a reasonable representation. Basically: (i) vertices belonging to the same connected componen- t/cluster (ie, datapoints connected with a path”, even if they are located far away or form odd shapes) will have the same value in the representation V = [✶C1 , . . . , ✶Ck ], and (ii) vertices belonging to different connected component/cluster will have distinct representation.  Thus making it easier for a k-means type algorithm to recover the clusterings.

(f)  For each of the datasets in part (i) (there are total three datasets), run this flexible version of k-means in the transformed space.  Show the resulting clustering assignment on all the datasets. Does it improve the clustering quality? How does the choice of r (in Gr )

affects the result?

(You must submit your code for parts (a) and (f) to receive full credit.  All plots and analysis must be included in the pdf document.)