Reputation: 41841
I need and example showing how to use K-means clustering in MATLAB but using some prespecified datapoints as the initial seeds.
Thanks
Upvotes: 2
Views: 4468
Reputation: 74940
IDX = kmeans(X,k,'start',seeds)
will run K-means with predefined datapoints seeds
(such as k
rows of X
, but you can choose any seeds as long as it's a k
-by-p array, where p is the number of columns of X
) as initial seeds. Note that if you specify seeds
, you don't need to specify k
(pass []
instead). kmeans
will infer from the number of rows of seeds
how many clusters you want.
By default, kmeans
chooses k
randomly picked rows of X
as seeds.
Upvotes: 4