導航:首頁 > 源碼編譯 > 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演算法相關的資料

熱點內容
工作三年的大專程序員 瀏覽:726
java畢業設計文獻 瀏覽:140
籌碼集中度指標源碼 瀏覽:478
listsortjava 瀏覽:183
plc閃光電路編程實例 瀏覽:299
socket編程試題 瀏覽:204
華為的伺服器怎麼設置從光碟機啟動 瀏覽:868
程序員真的累嗎 瀏覽:326
學信網app為什麼刷臉不了 瀏覽:873
天蠍vs程序員 瀏覽:994
單片機下載口叫什麼 瀏覽:188
程序員的道 瀏覽:926
雲伺服器不實名違法嗎 瀏覽:558
怎樣查看文件夾圖片是否重復 瀏覽:995
文件怎麼導成pdf文件 瀏覽:808
打開sql表的命令 瀏覽:103
安卓手機如何面部支付 瀏覽:38
天元數學app為什麼登錄不上去 瀏覽:824
明日之後為什麼有些伺服器是四個字 瀏覽:104
安卓系統l1是什麼意思 瀏覽:26