Question: Using python, implement your own version of the k-means algorithm using both mean and median. (We will focus on K-Medoids next week.) Create your

Using python, implement your own version of the k-means algorithm using both mean and median. (We will focus

Using python, implement your own version of the k-means algorithm using both mean and median. (We will focus on K-Medoids next week.) Create your implementation that takes: a dataset x, a list of center points c (each of n-dimension) and a enum type that indicates if you are using mean or median. (You can try to pass a function but you will have other dependent code that is based on whether you using the mean or median.) For the sample data set use euclidean distance and do not terminate your algorithm until none of the center points have changed. Use the following data: x = [[1, 2], [2, 1], [1, 3], [5, 4], [6, 3], [7, 2], [6, 1]] Q1: k-means, use center points: c = [[2, 2], [3, 4], [6, 21] Q2: k-means, use center points: c = [[3, 3], [4,1]] Q3: k-medians, use center points: c = [[2, 2], [3, 4], [6, 211 For each problem show the iterations, calculating the new center points (2-dimensional center points). Output the list of cluster values that each datapoint in x was assigned. (Cluster #'s should start at 0.)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Implementing the KMeans algorithm using both mean and median in Python involves several steps Below ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!