




















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!





















Machine Learning Department
School of Computer Science
Carnegie Mellon University
Readings:
Murphy (all chapters)
Bishop (all chapters)
HTF (all chapters)
Mitchell (all chapters)
Reminders
EXAM LOGISTICS
Final Exam
Final Exam
Tue, Dec. 6
th
at 5:30pm
(we will post them)
(see ‘More’ links on ‘Schedule’ page of course
website)
Final Exam
Topics covered before Midterm
Overfitting
Topics covered after Midterm
Samples Questions
13
10-601: Machine Learning Page 4 of 16 4/27/
2 K-Means Clustering [16 pts.]
2.1 General K-means questions (circle one answer)
(a) [3 pts] We are given n data points, x 1
, ..., x n
and asked to cluster them using K-means.
If we choose the value for k to optimize the objective function how many clusters will
be used (i.e. what value of k will we choose)? No justification required.
(i) 1 (ii) 2 (iii) n (iv) log(n)
Solution: n. Since the objective function would be minimized with k = n since there
is no regularization for the value of k.
(b) [3 pts] Why do we use Lloyds algorithm to find the K-means clustering assignments
instead of the brute force algorithm? Recall that the brute force algorithm for some
value k requires searching over all possible assignments of the data points into k clusters.
No justification required.
(i) Lloyd’s algorithm is guaranteed to find a clustering assignment.
(ii) Lloyd’s algorithm is guaranteed to converge in a linear number of steps.
(iii) The brute force algorithm can take an exponential number of steps (in worst case).
(iv) The brute force algorithm can take a polynomial number of steps (in worst case).
10-601: Machine Learning Page 4 of 16 4/27/
2 K-Means Clustering [16 pts.]
2.1 General K-means questions (circle one answer)
(a) [3 pts] We are given n data points, x 1
, ..., x n
and asked to cluster them using K-means.
If we choose the value for k to optimize the objective function how many clusters will
be used (i.e. what value of k will we choose)? No justification required.
(i) 1 (ii) 2 (iii) n (iv) log(n)
Solution: n. Since the objective function would be minimized with k = n since there
is no regularization for the value of k.
(b) [3 pts] Why do we use Lloyds algorithm to find the K-means clustering assignments
instead of the brute force algorithm? Recall that the brute force algorithm for some
value k requires searching over all possible assignments of the data points into k clusters.
No justification required.
(i) Lloyd’s algorithm is guaranteed to find a clustering assignment.
(ii) Lloyd’s algorithm is guaranteed to converge in a linear number of steps.
(iii) The brute force algorithm can take an exponential number of steps (in worst case).
(iv) The brute force algorithm can take a polynomial number of steps (in worst case).
Samples Questions
− 1 −0.5 0 0.5 1 1.5 2 2.5 3
− 1
−0.
0
1
2
3
Circle the image which depicts
the cluster center positions after 1
iteration of Lloyd’s algorithm.
(iii) The brute force algorithm can take an exponential number of steps (in worst case).
(iv) The brute force algorithm can take a polynomial number of steps (in worst case).
Solution: (c) The brute force algorithm can take an exponential number of steps (in
worst case).
2.2 Lloyd’s algorithm
We are given data drawn from two independent multivariate Gaussian distributions. The
data are shown in Figure 2 with the initial cluster centers as red crosses.
Sample Questions
18
Machine Learning 10-601 Midterm II 8 of 13 April 29, 2015
Question 4: Expectation Maximization
Given a set of observed variables X, a set of latent variables Z, and a set of model parameters with the
current estimate being ✓, a single iteration of the EM algorithm updates the parameters estimate ✓ as follows:
✓ arg max
✓
0
Q(✓
0 |✓) ⌘ E P (Z|X,✓) [log P (X, Z|✓
0 )]
where log P (X, Z|✓
0 ) = log
Q n
i=
P (X i , Z i |✓
0 ) is known as the complete log likelihood of the data.
4.1 Short Answer [6 pt.]
(a) [2 pts] True or False: In the case of fully observed data, i.e. when Z is an empty set, the EM algorithm
reduces to a maximum likelihood estimate.
(b) [2 pts] True or False: Since the EM algorithm guarantees that the value of its objective function will
increase on each iteration, it is guaranteed to eventually reach a global maximum.
(c) [2 pts] Suppose you introduce some prior on the parameters ✓ and you want to modify an EM algorithm
so that it computes MAP estimates of the model parameters instead of MLE estimates. Which step(s)
of the algorithm would you need to change?
i. This modification is not possible
ii. Only the E step
iii. Only the M step
iv. Both the E and M steps
4.2 Deriving EM [10 pt.+3 Extra Credit]
Machine Learning 10-601 Midterm II 8 of 13 April 29, 2015
Question 4: Expectation Maximization
Given a set of observed variables X, a set of latent variables Z, and a set of model parameters with the
current estimate being ✓, a single iteration of the EM algorithm updates the parameters estimate ✓ as follows:
✓ arg max
✓
0
Q(✓
0 |✓) ⌘ E P (Z|X,✓)
[log P (X, Z|✓
0 )]
where log P (X, Z|✓
0 ) = log
Q n
i=
P (X i , Z i |✓
0 ) is known as the complete log likelihood of the data.
4.1 Short Answer [6 pt.]
(a) [2 pts] True or False: In the case of fully observed data, i.e. when Z is an empty set, the EM algorithm
reduces to a maximum likelihood estimate.
(b) [2 pts] True or False: Since the EM algorithm guarantees that the value of its objective function will
increase on each iteration, it is guaranteed to eventually reach a global maximum.
(c) [2 pts] Suppose you introduce some prior on the parameters ✓ and you want to modify an EM algorithm
so that it computes MAP estimates of the model parameters instead of MLE estimates. Which step(s)
of the algorithm would you need to change?
i. This modification is not possible
ii. Only the E step
iii. Only the M step
iv. Both the E and M steps
4.2 Deriving EM [10 pt.+3 Extra Credit]
Machine Learning 10-601 Midterm II 8 of 13 April 29, 2015
Question 4: Expectation Maximization
Given a set of observed variables X, a set of latent variables Z, and a set of model parameters with the
current estimate being ✓, a single iteration of the EM algorithm updates the parameters estimate ✓ as follows:
✓ arg max
✓
0
Q(✓
0 |✓) ⌘ E P (Z|X,✓)
[log P (X, Z|✓
0 )]
where log P (X, Z|✓
0 ) = log
Q n
i=
P (X i , Z i |✓
0 ) is known as the complete log likelihood of the data.
4.1 Short Answer [6 pt.]
(a) [2 pts] True or False: In the case of fully observed data, i.e. when Z is an empty set, the EM algorithm
reduces to a maximum likelihood estimate.
(b) [2 pts] True or False: Since the EM algorithm guarantees that the value of its objective function will
increase on each iteration, it is guaranteed to eventually reach a global maximum.
(c) [2 pts] Suppose you introduce some prior on the parameters ✓ and you want to modify an EM algorithm
so that it computes MAP estimates of the model parameters instead of MLE estimates. Which step(s)
of the algorithm would you need to change?
i. This modification is not possible
ii. Only the E step
iii. Only the M step
iv. Both the E and M steps
Sample Questions 10-601: Machine Learning Page 9 of 15 4/27/
4 Principal Component Analysis [16 pts.]
(a) In the following plots, a train set of data points X belonging to two classes on R
2
are given, where the original features are the coordinates (x, y). For each, answer the
following questions:
(i) [3 pt.] Draw all the principal components.
(ii) [6 pts.] Can we correctly classify this dataset by using a threshold function after
projecting onto one of the principal components? If so, which principal component
should we project onto? If not, explain in 1–2 sentences why it is not possible.
Dataset 1:
Response to question (ii):
10-601: Machine Learning Page 9 of 15 4/27/
4 Principal Component Analysis [16 pts.]
(a) In the following plots, a train set of data points X belonging to two classes on R
2
are given, where the original features are the coordinates (x, y). For each, answer the
following questions:
(i) [3 pt.] Draw all the principal components.
(ii) [6 pts.] Can we correctly classify this dataset by using a threshold function after
projecting onto one of the principal components? If so, which principal component
should we project onto? If not, explain in 1–2 sentences why it is not possible.
Dataset 1:
Response to question (ii):
(i) [3 pt.] Draw all the principal componen
(ii) [6 pts.] Can we correctly classify this d
projecting onto one of the principal com
should we project onto? If not, explain
Dataset 1:
Response
Dataset 2:
Response
Sample Questions
the simple dataset shown in Figure 5a. Even though the crosses and circles are not linearly
separable, we can break the examples into three groups, S 1 , S 2 , and S 3 (shown in Figure 5a)
so that S 1
is linearly separable from S 2
and S 2
is linearly separable from S 3
. We will exploit
this fact to design weights for the neural network shown in Figure 5b in order to correctly
classify this training set. For all nodes, we will use the threshold activation function