| ²é¿´: 1196 | »Ø¸´: 0 | |||
xiaxiaozhiгæ (³õÈëÎÄ̳)
|
[ÇóÖú]
matlabµÄ¾ÛÀà·ÖÎö
|
|
n = 300 ; c = 3; t = randperm(n) ; x = [randn(1,n/3)-2 randn(1,n/3) randn(1,n/3)+2 ; randn(1,n/3) randn(1,n/3)+4 randn(1,n/3)]' ; m = x(t(1:c), ;x2 = sum(x.^2,2) ; s0(1:c,1)=inf; for o = 1 : 100 m2 = sum(m.^2,2) ; [d,y] = min(repmat(m2,1,n)+repmat(x2',c,1)-2*m*x') ; for j = 1 : c m(j, = mean(x(y==j, ) ;s(j,1) = mean(d(y==j)) ; end % norm£¨A£© ·µ»Ø¾ØÕóAµÄ¶þ·¶Êý % ¾ØÕóµÄ¶þ·¶Êý £º A' * A µÄ×î´óÌØÕ÷Öµ¿ªÆ½·½ % A = [0 1 2 ; 3 4 5 ; 6 7 8] ; % norm£¨A£© = sqrt(max(eig(A'*A))) = 14.2267 if norm(s-s0) < 0.001 break ; end s0 = s ; end figure(1) ;%´´½¨Í¼Ðδ°¿Ú clf ;%Çå³ýµ±Ç°Í¼Ïñ´°¿Ú hold on ; plot(x(y==1,1),x(y==1,2),'bo') ; plot(x(y==2,1),x(y==2,2),'rx') ; plot(x(y==3,1),x(y==3,2),'gv') ; ±¾È˳õѧÕߣ¬Óе㿴²»¶®£¬ÓÈÆäÊÇ´Ófor¿ªÊ¼£¬²»ÖªµÀ¾ÛÀàΪʲôÕâÑùд£¬Çë´Í½Ì |
» ²ÂÄãϲ»¶
300Çóµ÷¼Á
ÒѾÓÐ8È˻ظ´
Çóµ÷¼ÁÍÆ¼ö
ÒѾÓÐ7È˻ظ´
289 ·Ö105500ҩѧר˶Çóµ÷¼Á(ÕÒBÇøÑ§Ð£)
ÒѾÓÐ4È˻ظ´
0854Çóµ÷¼Á
ÒѾÓÐ13È˻ظ´
³õÊÔ324 ÖÐҩѧ Ò»Ö¾Ô¸ÌìÖÐÒ½ Çóµ÷¼Á
ÒѾÓÐ3È˻ظ´
ҩѧÇóµ÷¼Á
ÒѾÓÐ14È˻ظ´
327Çóµ÷¼Á
ÒѾÓÐ27È˻ظ´
¼±Ðèµ÷¼Á
ÒѾÓÐ5È˻ظ´
271Çóµ÷¼Á
ÒѾÓÐ33È˻ظ´
273Çóµ÷¼Á
ÒѾÓÐ8È˻ظ´













;
»Ø¸´´ËÂ¥