yf_pcmc1_step.m

来自「模糊C均值聚类的一个参考材料,做模糊聚类是用的一个程序」· M 代码 · 共 30 行

M
30
字号
function [V, T, E] = Yf_PCMC1_Step(X, V, w, c, m)
%Yf_PCMC1_Step One step in PCM clustering.
%
%   See Yf_PCMC1.m  
%
%   Mahdi Amiri, June 17, 2003
%   http://yashil.20m.com/

n = size(X, 1);
p = size(X, 2);

% Fill the distance matrix
dist = Yf_EuDistArrayOfVectors1 (V, X);

% Claculate new T
w = w(:);
tmp = (dist .^ 2) ./ ( w * ones (1, n));
tmp = tmp.^(1/(m-1));
T = 1 ./ (1 + tmp);

% For the situation of "singularity" (one of the data points is
% exactly the same as one of the cluster centers) T will be one.

V_old = V;

mf = T.^m; % MF matrix after exponential modification
V = mf*X./((ones(p, 1)*sum(mf'))'); % new center

E = norm (V - V_old, 1);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?