資源簡(jiǎn)介
這里面的matlab代碼是BOW的實(shí)現(xiàn),里面有kmeans++的部分,模塊化,易理解,稍微改動(dòng)就可以用于解決自己的問(wèn)題
代碼片段和文件信息
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)是數(shù)據(jù)集合X的數(shù)據(jù)點(diǎn)的數(shù)目,C是中心點(diǎn)的集合
????L?=?ones(1size(X2));
評(píng)論
共有 條評(píng)論