当前位置:首页 » 操作系统 » 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~~~')#实例调用类方法

运行效果:

热点内容
python执行sql文件 发布:2025-03-19 15:05:35 浏览:266
表格式脚本写作 发布:2025-03-19 14:58:52 浏览:721
解压蜜蜂 发布:2025-03-19 14:58:02 浏览:250
百家站源码 发布:2025-03-19 14:56:47 浏览:475
安卓和unity哪个累 发布:2025-03-19 14:31:39 浏览:677
雅阁电动座椅怎么配置 发布:2025-03-19 14:28:30 浏览:635
探月编程课 发布:2025-03-19 14:22:34 浏览:311
62脚本怎么安装 发布:2025-03-19 14:04:25 浏览:573
php传值给html 发布:2025-03-19 14:02:05 浏览:608
windowsmedia缓存 发布:2025-03-19 14:02:00 浏览:765