|
|
|
@ -13,12 +13,10 @@ centroids = zeros(K, size(X, 2));
|
|
|
|
|
% the dataset X
|
|
|
|
|
%
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% Randomly reorder the indices of examples
|
|
|
|
|
randidx = randperm(size(X, 1));
|
|
|
|
|
% Take the first K examples as centroids
|
|
|
|
|
centroids = X(randidx(1:K), :);
|
|
|
|
|
|
|
|
|
|
% =============================================================
|
|
|
|
|
|
|
|
|
|