當前位置:首頁 » 操作系統 » fcm演算法實現

fcm演算法實現

發布時間: 2023-07-02 13:00:33

A. 模糊c-均值聚類演算法的FCM 演算法簡介

假設樣本集合為X={x1 ,x2 ,…,xn },將其分成c 個模糊組,並求每組的聚類中心cj ( j=1,2,…,C) ,使目標函數達到最小。

B. matlab中的功能函數FCM如何使用

模糊C均值聚類演算法,可將輸入的數據集data聚為指定的cluster_n類

【函數描述】
語法格式
[center, U, obj_fcn] = FCM(data, cluster_n, options)

用法:
1. [center,U,obj_fcn] = FCM(Data,N_cluster,options);
2. [center,U,obj_fcn] = FCM(Data,N_cluster);

輸入變數
data ---- n*m矩陣,表示n個樣本,每個樣本具有m維特徵值
cluster_n ---- 標量,表示聚合中心數目,即類別數
options ---- 4*1列向量,其中
options(1): 隸屬度矩陣U的指數,>1(預設值: 2.0)
options(2): 最大迭代次數(預設值: 100)
options(3): 隸屬度最小變化量,迭代終止條件(預設值: 1e-5)
options(4): 每次迭代是否輸出信息標志(預設值: 0)

輸出變數
center ---- 聚類中心
U ---- 隸屬度矩陣
obj_fcn ---- 目標函數值

C. matlab中的fcm演算法中的u矩陣怎麼初始化

matlab中的fcm演算法中的u矩陣怎麼初始化
模糊C均值聚類演算法,可將輸入的數據集data聚為指定的cluster_n類

【函數描述】
語法格式
[center, U, obj_fcn] = FCM(data, cluster_n, options)

用法:
1. [center,U,obj_fcn] = FCM(Data,N_cluster,options);
2. [center,U,obj_fcn] = FCM(Data,N_cluster);

D. 急求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

E. 在matlab中做模糊C均值聚類(fcm)演算法如何體現初始隸屬度

它的程序裡面是用rand函數隨機初始化了一個矩陣N*c,然後對這個隨機矩陣進行歸一化,即滿足一行(也可能是列記不清楚了),反正是讓它滿足隸屬度的每個樣本屬於所有類隸屬度為1的條件。用這個矩陣進行初始化,計算新的中心 新的隸屬度 新的中心。。。。 知道滿足閾值。matlab裡面自己有函數一招就能找到

F. python 中如何調用FCM演算法

以下代碼調試通過:

1234567classLuciaClass:#定義類defluciaprint(self,text):#類裡面的方法print(' ',text)#方法就是輸出textx=LuciaClass()#方法的實例xx.luciaprint('todayisabadday~~~')#實例調用類方法

運行效果:

熱點內容
java輸出到文件 發布:2025-03-19 01:49:07 瀏覽:431
光遇國際服安卓和蘋果如何互通 發布:2025-03-19 01:43:03 瀏覽:318
如何加密應用 發布:2025-03-19 01:42:04 瀏覽:619
lol伺服器人數怎麼擠 發布:2025-03-19 01:29:19 瀏覽:839
兄弟連的php 發布:2025-03-19 01:24:25 瀏覽:812
自己做腳本可不可以 發布:2025-03-19 01:20:13 瀏覽:534
33的源碼值 發布:2025-03-19 01:13:25 瀏覽:814
虛榮安卓怎麼充值 發布:2025-03-19 01:12:27 瀏覽:892
如何更改報考密碼 發布:2025-03-19 01:08:12 瀏覽:416
python日期類型 發布:2025-03-19 01:02:28 瀏覽:416