function [Umat, Cmat, it] = FuzzyCluster(Xdat, C, m, epsilon, itmax)
% Possibilisity Clustering Algorithm
% 2010/03/16
% ------ INPUT -------
% Xdat
% C
% m
% epsilon
% itmax
% ------ OUTPUT ------
% Cmat
% Umat
% num
% valJ
[Nrow, Ncol] = size(Xdat);
% select clustering centers randomly;
Cmat = PCA_InitC(Xdat, C);
% calculate distance between samples and centers
Dmat = PCA_ClacD(Xdat, Cmat);
Umat = PCA_ClacU(m , Dmat);
Ut = Umat;
St = 0;
it = 0;
while (it<itmax & St~=1)
% update Cmat, the matrix of centroids, from Xdat and Ut
Cmat = PCA_CalcC(Xdat, C, m, Ut);
% update Dmat, the matrix of distance
Dmat = PCA_ClacD(Xdat, Cmat);
% update Umat, the matrix of pixel membership
Umat = PCA_ClacU(m , Dmat);
% compute the diffrence between U(St+1) and U(St)
Utmp = abs(Umat-Ut);
fnrm = norm(Utmp,'fro');
% judge if fnrm is smaller than epsilon
if(fnrm<epsilon)
St = 1;
else
Ut = Umat;
end
it = it+1;
end
% valJ = fcm_evalJ(Umat,mfuz,Dmat);
return
评论1