Homework 7
Zhankun Luo
PUID: 0031195279
Email: luo333@pnw.edu
Fall-2018-ECE-59500-009
Instructor: Toma Hentea
文章目录
Function
plot_cluster.m
function [] = plot_cluster(X2, bel, theta)
plot(X2(1,bel==1),X2(2,bel==1),'r.',...
X2(1,bel==2),X2(2,bel==2),'g*',X2(1,bel==3),X2(2,bel==3),'bo',...
X2(1,bel==4),X2(2,bel==4),'cx',X2(1,bel==5),X2(2,bel==5),'md',...
X2(1,bel==6),X2(2,bel==6),'yp',X2(1,bel==7),X2(2,bel==7),'ks')
hold on, plot(theta(1,:), theta(2,:),'k+')
end
k_means.m
Hard Clustering: k-means
Where
d ( x i , θ j ( t ) ) = [ x i − θ j ( t ) ] T [ x i − θ j ( t ) ] ∑ i = 1 N u i j ( t − 1 ) ∂ d ( x i , θ j ( t ) ) ∂ θ j = 2 ∑ i = 1 N u i j ( t − 1 ) [ θ j ( t ) − x i ] = 0 d(x_i, \theta_j(t))=[x_i - \theta_j(t)]^T[x_i - \theta_j(t)]\\ \sum_{i=1}^{N} u_{ij}(t-1) \frac{\partial d(x_i, \theta_j(t))}{\partial \theta_j} = 2\sum_{i=1}^{N} u_{ij}(t-1) [\theta_j(t) - x_i] = 0\\ d(xi,θj(t))=[xi−θj(t)]T[xi−θj(t)]i=1∑Nuij(t−1)∂θj∂d(xi,θj(t))=2i=1∑Nuij(t−1)[θ