📄 yf_fpcmc1_step.m
字号:
function [V, U, T, E] = Yf_FPCMC1_Step(X, V, c, m, eta)
%Yf_FPCMC1_Step One step in fuzzy-possibilistic c-mean clustering.
%
% See Yf_FPCMC1.m
%
% Mahdi Amiri, June 20, 2003
% http://yashil.20m.com/
n = size (X, 1);
p = size (X, 2);
dist = Yf_EuDistArrayOfVectors1 (V, X); % fill the distance matrix
% calculate new U, suppose m != 1
tmp = dist.^(-2/(m-1));
U = tmp./(ones(c, 1)*sum(tmp));
% Correct the situation of "singularity" (one of the data points is
% exactly the same as one of the cluster centers).
si = find (tmp == Inf);
U(si) = 1;
if (size (si, 1) ~= 0)
display ('FPCMC, Warning: Singularity occured and corrected.');
end
% calculate new T, suppose eta != 1
tmp = dist.^(-2/(eta-1));
T = tmp./((sum(tmp')') * ones(1,n));
% Correct the situation of "singularity" (one of the data points is
% exactly the same as one of the cluster centers).
T(si) = 1; % Do more later
% Check constraint
tmp = find ((sum (T') - ones (1, c)) > 0.0001);
if (size(tmp,2) ~= 0)
display ('FPCMC, Warning: Constraint for T is not hold.');
end
% Scale T
%maxU = max(max(U));
%maxT = max(max(T));
%if maxT < .5
% ScF = .5 / maxT;
% T = T * ScF;
%end
V_old = V;
Us = U.^m;
Ts = T.^eta;
V = ((Us+Ts)*X) ./ ((ones(p, 1)*sum((Us+Ts)'))'); % new center
E = norm (V - V_old, 1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -