# CS558 Computer Vision Homework #2 Instructor: Wei Liu ```CS558 Computer Vision
Homework #2
Instructor: Wei Liu
Due on April 10, 2015, 6:00pm
Problem 1. Hierarchical Clustering (30 points)
We want to run an algorithm of Hierarchical K-Means Clustering to cluster a data set {xi }ni=1 into 1,048,576
1) If K = 2 for all K-Means clustering actions, what is the height (or depth) of the clustering tree constructed
by the algorithm?
2) Suppose K = 2. To cluster a new data point x, how many distances between x and the obtained cluster
centers should be computed?
3) Please design the data structure for the clustering tree. For the nodes (including root, not leaf), what should
be saved in them? For the leaf nodes, what should be saved in them?
(Hint: The total number of cluster centers obtained by the Hierarchical K-Means Clustering algorithm is much
larger than 1,048,576. Many parent clusters or intermediate clusters exist. )
Problem 2. Implementation of Clustering (20 points)
Please try two clustering algorithms over the training set (60,000 examples) of the MNIST dataset (acquired
from http://yann.lecun.com/exdb/mnist/).
1) Implement K-Means Clustering with K = 25. Report the running time, and display the 25 cluster centers
(output 25 “center” images) you obtain eventually.
2) Implement Hierarchical K-Means Clustering with K = 5 and height being 2. Report the running time, and
display the 25 cluster centers (output 25 “center” images) you obtain eventually.
(Hint: You are not allowed to use the K-Means function provided by Matlab. Send your code in a separate file. )
Problem 3. Light (10 points)
We see a diffuse sphere centered at the origin, with radius one and albedo ρ, in an orthographic camera, looking
down the z-axis. This sphere is illuminated by a distant point light source whose source direction is (0, 0, 1).
There is no other illumination. Show that the shading field (i.e., the image pixel intensity) in the camera is
p
ρ 1 − x2 − y 2 .
(Hint: What is the angle between the light source and the normal vector of a point at (x, y, z) in the surface of
the sphere? )
What to turn in?
You should make your answers in a PDF file and name it as:
[yourf irstname] [yourlastname] HW2.pdf
```