导航:首页 > 源码编译 > fcm算法

fcm算法

发布时间:2022-01-18 05:42:06

A. k-means算法和fcm算法有什么不同

K均值聚类算法即是HCM(普通硬-C均值聚类算法),它是一种硬性划分的方法,结果要么是1要么是0,没有其他情况,具有“非此即彼”的性质。里面的隶属度矩阵是U。 FCM是把HCM算法推广到模糊情形,用在模糊性的分类问题上,给了隶属度一个权重。

B. 寻找FCM聚类算法的聚类中心数据

聚类可以理解为根据你划定的半径取圈样本,圈出几类就是几类,半径大类就少,半径小类就多。中心选择可以随机选取,那就是无监督算法,现在有一种半监督算法,先用少量标记好的样本产生一些类别作为聚类中心,指导聚类的过程。可以使用kmeans和SVM结合

C. 急求FCM算法在C或MATLAB上实现

function [U,V,num_it]=fcm(U0,X)

% MATLAB (Version 4.1) Source Code (Routine fcm was written by Richard J.

% Hathaway on June 21, 1994.) The fuzzification constant

% m = 2, and the stopping criterion for successive partitions is epsilon =??????.

%*******Modified 9/15/04 to have epsilon = 0.00001 and fix univariate bug********

% Purpose:The function fcm attempts to find a useful clustering of the

% objects represented by the object data in X using the initial partition in U0.

%

% Usage: [U,V,num_it]=fcm(U0,X)

%

% where: U0 = on entry, the initial partition matrix of size c x n

% X = on entry, the object data matrix of size s x n

% U = on exit, the final partition matrix of size c x n

% V = on exit, the final prototype matrix of size s x c

% num_it = on exit, the number of iterations done

% Check for legal input values of U0 and X:

%

[c,n]=size(U0);

[s,nn]=size(X);

if min(min(U0)) < 0 | max(max(U0)) > 1 | any(abs(sum(U0) - 1) > .001),

error('U0 is not properly initialized.')

elseif nn ~= n,

error('Dimensions of U0 and X are inconsistent.')

end;

%

% Initialize variables:

%

temp=zeros(c,n); num_it=0; max_it=1000; U=U0; d=zeros(c,n);

epsilon=.00001;min_d=1.0e-100; step_size=epsilon; Vones=zeros(s,n);

%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%

% Begin the main loop:

%

while num_it < max_it & step_size >= epsilon,

num_it = num_it + 1;

U0 = U;

%

% Get new V prototypes:

%

temp = U0 .* U0;

work = sum(temp');

V = X*temp';

for i=1:c, V(:,i) = V(:,i) / work(i); end

%

% Get new squared-distance values d:

%

% First, get new initial values for d:

for i=1:c,

for j=1:s,

Vones(j,:)=V(j,i)*ones(1,n);

end

temp = X - Vones;

temp = temp.*temp;

if s > 1,

d(i,:) = sum(temp);

else

d(i,:) = temp;

end

end

% Second, adjust all d values to be at least as big as min_d:

j = find(d < min_d);

d(j) = d(j) - d(j) + min_d;

%

% Get new partition matrix U:

%

U = 1 ./ d;

work = sum(U);

for i=1:c, U(i,:) = U(i,:) ./ work; end

%

% Calculate step_size and return to top of loop:

%

step_size=max(max(abs(U-U0)));

%

% End the main loop:

%

end

%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

return

D. 谁有FCM算法的源程序,谢谢!

我贴部分FCM的Matlab代码:
expo = options(1); % Exponent for U
max_iter = options(2); % Max. iteration
min_impro = options(3); % Min. improvement
display = options(4); % Display info or not

obj_fcn = zeros(max_iter, 1); % Array for objective function

U = initfcm(cluster_n, data_n); % Initial fuzzy partition
% Main loop
for i = 1:max_iter,
[U, center, obj_fcn(i)] = stepfcm(data, U, cluster_n, expo);
if display,
fprintf('Iteration count = %d, obj. fcn = %f\n', i, obj_fcn(i));
end
% check termination condition
if i > 1,
if abs(obj_fcn(i) - obj_fcn(i-1)) < min_impro, break; end,
end
end

其中
U = initfcm(cluster_n, data_n); % Initial fuzzy partition

这个就是初始化划分矩阵,随机产生一个隶属度矩阵,

代码如下:
U = rand(cluster_n, data_n);
col_sum = sum(U);
U = U./col_sum(ones(cluster_n, 1), :);

上面就是它初始化的一个隶属度矩阵,
cluster_n行,data_n列。
即一列中从上到下表示每个样本隶属与每一类的隶属度。
然后在算法中不断迭代,
最后得到的还是如此大的一个矩阵,代表每个样本隶属与每一类的隶属度
然后选择最大的那个就是,它就属于那一类。

E. 有人会使用FCM算法吗

function [U,center,result,w,obj_fcn]= fenlei(data)
[data_n,in_n] = size(data);
m= 2; % Exponent for U
max_iter = 100; % Max. iteration
min_impro =1e-5; % Min. improvement
c=3;
[center, U, obj_fcn] = fcm(data, c);
for i=1:max_iter
if F(U)>0.98
break;
else
w_new=eye(in_n,in_n);
center1=sum(center)/c;
a=center1(1)./center1;
deta=center-center1(ones(c,1),:);
w=sqrt(sum(deta.^2)).*a;
for j=1:in_n
w_new(j,j)=w(j);
end
data1=data*w_new;
[center, U, obj_fcn] = fcm(data1, c);
center=center./w(ones(c,1),:);
obj_fcn=obj_fcn/sum(w.^2);
end
end
display(i);
result=zeros(1,data_n);U_=max(U);
for i=1:data_n
for j=1:c
if U(j,i)==U_(i)
result(i)=j;continue;
end
end
end

F. matlab如何调用fcm函数处理一副图像。 不是查看fcm函数,算法我已经了解了,我只是不知道

data = rand(100, 2);
[center,U,obj_fcn] = fcm(data, 2);
plot(data(:,1), data(:,2),'o');
maxU = max(U);
index1 = find(U(1,:) == maxU);
index2 = find(U(2, :) == maxU);
line(data(index1,1),data(index1, 2),'linestyle','none',...
'marker','*','color','g');
line(data(index2,1),data(index2, 2),'linestyle','none',...
'marker', '*','color','r');

G. 在matlab中做模糊C均值聚类(fcm)算法如何体现初始隶属度

它的程序里面是用rand函数随机初始化了一个矩阵N*c,然后对这个随机矩阵进行归一化,即满足一行(也可能是列记不清楚了),反正是让它满足隶属度的每个样本属于所有类隶属度为1的条件。用这个矩阵进行初始化,计算新的中心 新的隶属度 新的中心。。。。 知道满足阈值。matlab里面自己有函数一招就能找到

H. python 中如何调用FCM算法

以下代码调试通过:

1234567classLuciaClass:#定义类defluciaprint(self,text):#类里面的方法print(' ',text)#方法就是输出textx=LuciaClass()#方法的实例xx.luciaprint('todayisabadday~~~')#实例调用类方法

运行效果:

I. 求:FCM,PCM聚类算法MATLAB程序

function [U,center,result,w,obj_fcn]= fenlei(data)
[data_n,in_n] = size(data);
m= 2; % Exponent for U
max_iter = 100; % Max. iteration
min_impro =1e-5; % Min. improvement
c=3;
[center, U, obj_fcn] = fcm(data, c);
for i=1:max_iter
if F(U)>0.98
break;
else
w_new=eye(in_n,in_n);
center1=sum(center)/c;
a=center1(1)./center1;
deta=center-center1(ones(c,1),:);
w=sqrt(sum(deta.^2)).*a;
for j=1:in_n
w_new(j,j)=w(j);
end
data1=data*w_new;
[center, U, obj_fcn] = fcm(data1, c);
center=center./w(ones(c,1),:);
obj_fcn=obj_fcn/sum(w.^2);
end
end
display(i);
result=zeros(1,data_n);U_=max(U);
for i=1:data_n
for j=1:c
if U(j,i)==U_(i)
result(i)=j;continue;
end
end
end

阅读全文

与fcm算法相关的资料

热点内容
湖南根服务器云服务器 浏览:653
2003word压缩图片 浏览:390
解压小玩具小桃子 浏览:486
查看linux内核参数 浏览:776
幼儿初学史丰收速算法指法视频 浏览:428
pythonacquire参数 浏览:825
汤普森钢琴教程2pdf 浏览:490
程序员小陈别墅 浏览:614
固态编译器损坏 浏览:3
android控件显示和隐藏 浏览:186
国产编译dspic的软件 浏览:295
隐尤app是什么 浏览:494
钉钉作业怎么传到文件夹 浏览:186
pg库二进制和源码的区别 浏览:328
群星服务器怎么看 浏览:144
玛雅服务器名称是什么 浏览:819
源码乐园官网 浏览:892
加密币前景 浏览:881
安卓正面接口和反面接口什么意思 浏览:710
怎样把文件夹的名字去掉 浏览:960