資源簡介
這里面的matlab代碼是BOW的實現,里面有kmeans++的部分,模塊化,易理解,稍微改動就可以用于解決自己的問題
代碼片段和文件信息
function?[LC]?=?kmeanspp(Xk)
%KMEANS?Cluster?multivariate?data?using?the?k-means++?algorithm.
%???[LC]?=?kmeans_pp(Xk)?produces?a?1-by-size(X2)?vector?L?with?one?class
%???label?per?column?in?X?and?a?size(X1)-by-k?matrix?C?containing?the
%???centers?corresponding?to?each?class.
%???Version:?2013-02-08
%???Authors:?Laurent?Sorber?(Laurent.Sorber@cs.kuleuven.be)
X=X‘;
L?=?[];
L1?=?0;
while?length(unique(L))?~=?k
????%?The?k-means++?initialization.
????C?=?X(:1+round(rand*(size(X2)-1)));?%size(X2)是數據集合X的數據點的數目,C是中心點的集合
????L?=?ones(1size(X2));
- 上一篇:遺傳算法優化BP神經網絡程序
- 下一篇:Raptor編碼
評論
共有 條評論