Question: Finish the matlab function to implement k means below, where X in the parameters is random data imported from a .dat file, idx is data
Finish the matlab function to implement k means below, where X in the parameters is random data imported from a .dat file, idx is data points assigned to nearest centroid, k = 5. The function updateCentroids should re-compute the cluster centroids by using the mean of all the data points in each cluster and assign the calculated mean as new centroid of the cluster.:

function centroids = updateCentroids (X, idx, K) [m n] = size(X); centroids = zeros (K, n); for i=1:6 % you code here end function centroids = updateCentroids (X, idx, K) [m n] = size(X); centroids = zeros (K, n); for i=1:6 % you code here end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
