Question

Note: COMP 642 Assignment 1. Implement k-means from scratch You are given a dataset X whose rows represent different data points, you are asked to perform a k-means clustering on

this dataset using the Manhattan Distance, k is chosen as 3. X = ——— C. MODULE 7 - The Manhattan Distance of (x₁, y₁) and (x₂, Y₂) is calculated by Dist= |X₁ X₂|+|y₁ - y₂l. 5.7 64₁ 4.7 58 6.1 56 4.6 64 5.4 84 4.9 60 5.0 62 6.4 62 5.1 76 16.0 601 a. Since first column and second column are not on the same scale. Before running K-means, this dataset needs to be preprocessed, Show the preprocessed dataset. (Answer in the format of [x1, x2], round your results to two decimal places, same as problems b and c) = b. Suppose the initial centroids of the clusters are μ₁ [5.6, 60], ₂= [5.9,60], μ3 = [5.2, 75]. What's the center of the second cluster after two iterations? What's the center of the third cluster when the clustering converges? d. How many iterations are required for the clusters to converge? 2. Hierarchical Clustering Suppose there are two clusters A (red) and B (blue), each has four members and plotted in Figure below, compute the distance between two clusters using Euclidean distance. 3.4 3.3 3.1 T T 2.7- 4.5 (4.7, 3.2) (4.9, 3.1) (4.6, 2.9) (5.0, 3.0) 5 5.5 (5.9, 3.2) (6.0, 3.0) (6.2, 2.8) 6.5 C. What is the average distance between all pairs (Average-link)? (6.7, 3.1) d. Among all three distances above, which one is robust to noise? 7 a. What is the distance between the two farthest members (Complete-link) (round to four decimal places here, and next 2 problems)? b. What is the distance between the two closest members (Single-link)? 7.5 3. Fill out the code cells in hw_7.ipynb and answer the questions. Submit a .doc or .pdf with your written answers. Submit your Python notebook. Submit a PDF of your Python notebook.