Initial centroids for K-means clustering
16 ビュー (過去 30 日間)
古いコメントを表示
If I have an array (i.e., 5 by 3 matrix) can serve as the initial centroids for kmeans clustering, how can I properly initialize the kmeans algorithm?
(Matlab's kmeans function has more than 600 lines of code and I have no idea how to modify it...)
The purpose of having my own initial centroids rather than have them randomly generated in the kmeans function is to remove the randomness in the outputs.
P.s. Python has the answer to it but I don't know Python.
1 件のコメント
Adam
2019 年 9 月 17 日
編集済み: Adam
2019 年 9 月 17 日
You should always read the documentation before the code. The 'Start' option gives you the option to input your own initial cluster centres.
I always suggest using your embedded help though via
doc kmeans
and clicking on the 'Name','Value' hyperlink in the 2nd function signature to take you to the list of possible (Name,Value) pairs that are supported. If you always use the latest version of Matlab the online help is fine though.
回答 (1 件)
KALYAN ACHARJYA
2019 年 9 月 17 日
編集済み: KALYAN ACHARJYA
2019 年 9 月 17 日
Before I share the helpful link, I requested you to watch the Andrew Ng. lecture on Random Initialization of K menas (Machine Learning).
He suggests to avoid k-means stuck in local minima or ensure the optimize K-menas, choose multiple random initailizations.
Manual Initialization
2 件のコメント
Adam
2019 年 9 月 17 日
As I added in a comment above, the Matlab help is always the first place to go. This shows how you can do this.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!