ML-As-5
Q1
Given a set of 5 samples:
Try the k-means clustering algorithm to cluster the samples into 2 classes.
Consider Data point:
Data Point | Distance to | Distance to | Cluster |
---|---|---|---|
(0, 2) | 2 | (0,0) | |
(0, 0) | 0 | 5 | (0,0) |
(1, 0) | 1 | 4 | (0,0) |
(5, 0) | 5 | 0 | (5,0) |
(5, 2) | 2 | (5,0) |
Data Point | Distance to | Distance to | Cluster |
---|---|---|---|
(0, 2) | (0,0) | ||
(0, 0) | (0,0) | ||
(1, 0) | (0,0) | ||
(5, 0) | 1 | (5,0) | |
(5, 2) | 1 | (5,0) |
The cluster does not change after the second iteration. The final cluster assignments are:
Class-1:
Q2
Suppose there are three coins, denoted A, B, and C. The probabilities of these coins coming up heads are π, p and q. Conduct the following coin toss test. First, toss coin A and select coin B or coin C according to its result, with coin B being selected for heads and coin C for tails. Then toss the selected coin, with the result recorded as 1 for heads and 0 for tails. Repeat the test n times independently (here, n = 10). The observation results are as follows:
Suppose that only the result of the coin toss can be observed, but not the process of tossing. The question is how to estimate the probability that all three coins will come up heads, i.e., to find the maximum likelihood estimation of the model parameters θ = (π, p, q).
(Assuming that the initial value of the model parameter is
The likelihood of observing the data is:
Q3
With the known observation data
Initialization:
- Randomly initialize the parameters
. - The weights
and must satisfy .
E-step (Expectation step):
Compute the responsibility
where
M-Step (Maximization step):
Update the parameters using the responsibilities:
Iterate:
- Repeat the E-step and M-step until the parameters converge or the change is below a small threshold.
Component 0:
Component 1: