模糊聚类算法matlab

  • d2_687404
    了解作者
  • matlab
    开发工具
  • 12.2KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-02-22 10:16
    上传日期
模糊聚类算法matlab,模糊模型程序,只要输入数据就能输出聚类结果
模糊聚类算法matlab
  • FUZZCLUST
  • clust_normalize.m
    705B
  • SAMMON.M
    4.4KB
  • Kmeans.m
    1.9KB
  • FCMclust.m
    1.4KB
  • GKclust.m
    3KB
  • PCA.m
    1.3KB
  • Kmedoid.m
    2.3KB
  • GGclust.m
    2.5KB
  • PROJEVAL.M
    1.1KB
  • SAMSTR.M
    610B
  • validity.m
    4KB
  • clust_denormalize.m
    710B
  • clusteval.m
    3.1KB
  • FuzSam.m
    2.4KB
  • nDexample.m
    379B
内容介绍
function result = Sammon(proj,data,result,param) %function P = sammon(D, P, varargin) %SAMMON Computes Sammon's mapping of a data set. % Input and output arguments ([]'s are optional): % D (matrix) size dlen x dim, data to be projected % (struct) data or map struct % P (scalar) output dimension % (matrix) size dlen x odim, initial projection matrix % [value] (scalar) all different modes (the next argument) require % a value, default = 100 % [mode] (string) 'steps' or 'errlimit' or 'errchange' or 'seconds', % see below, default is 'steps' % [alpha] (scalar) iteration step size, default = 0.2 % [Dist] (matrix) pairwise distance matrix, size dlen x dlen. % % P (matrix) size dlen x odim, the projections % % The output dimension must be 2 or higher but (naturally) lower % than data set dimension. % % The mode argument determines the end condition for iteration. If % the mode argument is used, also the value argument has to be % specified. Different mode possibilities are: % 'steps' the iteration is terminated when it is run <value> % 'errlimit' steps, the iteration is terminated when projection error % is lower than <value>, % 'errchange' the iteration is terminated when change between % projection error on two successive iteration rounds % is less than <value> percent of total error, and % 'seconds' the iteration is terminated after <value> seconds % of iteration. % % Reference: Sammon, J.W. Jr., "A nonlinear mapping for data % structure analysis", IEEE Transactions on Computers, vol. C-18, % no. 5, 1969, pp. 401-409. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% check arguments %Adapt the data P = proj.P; %P projected data or dimension D = data.X; %Mdist = result.data.d; %d distances maxstep = param.max; alpha = param.alpha; m = param.m; % compute data dimensions orig_si = size(D); dim = orig_si(2); noc = orig_si(1); % output dimension / initial projection matrix if prod(size(P))==1, odim = P; P = rand(noc,odim)-0.5; else si = size(P); odim = si(end); if prod(si) ~= noc*odim, error('Initial projection matrix size does not match data size'); end end if odim > dim | odim < 2, error('Output dimension must be within [2, dimension of data]'); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% initialization % these are used quite frequently noc_x_1 = ones(noc, 1); odim_x_1 = ones(odim,1); %compute mutual distances between vectors Mdist = []; if isempty(Mdist) | all(isnan(Mdist(:))), fprintf(2, 'computing mutual distances\r'); dim_x_1 = ones(dim,1); for i = 1:noc, x = D(i,:); Diff = D - x(noc_x_1,:); Mdist(:,i) = sqrt((Diff.^2)*dim_x_1); end end [np,nc]=size(Mdist); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% action % sammon iteration x = P ; xu = zeros(noc, odim); xd = zeros(noc, odim); dq = zeros(noc, 1); dr = zeros(noc, 1); for i=1:maxstep % If you want to see the Sammon's projection plotted (in 2-D and 3-D case), % execute the code below; it is not in use by default to speed up % computation. if 1, clf if odim == 1, plot(x(:,1), noc_x_1, 'o'); elseif odim == 2, plot(x(:,1), x(:,2), 'o'); else plot3(x(:,1), x(:,2), x(:,3), 'o') end drawnow end for j = 1:noc, xd = -x + x(j*noc_x_1,:); xd2 = xd.^2; dpj = sqrt(sum(xd2'))'; dq = Mdist(:,j) - dpj; dr = Mdist(:,j) .* dpj; ind = find(dr ~= 0); term = dq(ind) ./ dr(ind); e1 = sum(xd(ind,:) .* term(:,odim_x_1)); term2 = ((1.0 + dq(ind) ./ dpj(ind)) ./ dpj(ind)) ./ dr(ind); e2 = sum(term) - sum(xd2(ind,:) .* term2(:,odim_x_1)); xu(j,:) = x(j,:) + alpha * e1 ./ abs(e2); end % move the center of mass to the center c = sum(xu) / noc; x = xu - c(noc_x_1, :); fprintf(2, '\r%d iterations', i); fprintf(2, ' '); end fprintf(2, '\n'); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% clean up % reshape orig_si(end) = odim; P = reshape(x, orig_si); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %computing cluster centers fm = result.data.f.^m; sumf = sum(fm); vs = (fm'*x)./(sumf'*ones(1,2)); %%%%%%%%%%%%%%%%%%%%%% result.proj.vp=vs; result.proj.P=x;
评论
    相关推荐
    • Matlab合集
      冈萨雷斯数字图像处理MATLAB版.中文版+数字图像处理第二版中文版(冈萨雷斯)+MATLAB-R2014a完全自学一本通+MATLAB R2016a完全自学一本通 素材文件+[模式识别与智能计算:MATLAB技术实现(第2版)].杨淑莹.扫描版
    • MATLAB教程
      MATLAB教程MATLAB教程MATLAB教程MATLAB教程MATLAB教程MATLAB教程
    • MATLAB
      MATLAB 该项目是在matlab上完成的,涉及创建和移动宇宙飞船和机器人。 太空飞船和机器人是使用Matlab中的简单几何形状创建的,并通过连续变换矩阵进行移动。 这个项目教我如何使用变换矩阵(旋转,平移等)的概念...
    • MATLAB基础
      一本学习matlab的一本好书
    • MATLAB编译器
      基于MATLAB 2018b版本介绍MATLAB编译器。介绍如何利用编译器将MATLAB代码编译为独立应用程序或组件,并在没有安装MATLAB的计算机上进行部署。
    • matlabruntime
      通过奇点容器运行您的matlab项目 可以在没有MATLAB的容器中运行matlab代码。 为此,我们首先需要通过Matlab编译器在本地构建相应的Matlab代码的独立应用程序,然后使用具有Matlab运行时( 的容器)运行该应用程序 )...
    • matlab实现
      matlab实现 matlab实现matlab实现matlab实现matlab实现
    • matlab 教程
      matlab 信号处理资料,里面包含信号处理pdf文档,一些杂乱的程序和命令等
    • matlab教程
      matlab教程,PPT格式,包含 matlab基本知识、matlab入门、matlab作图、线性规划、无约束优化、非线性规划、统计工具箱、差值、微分方程等多项知识点,并且每个知识点独立成为PPT,内还含有matlab信号处理详解等文档...
    • matlab简介
      1.MATLAB 开发环境 1.1 MATLAB 的视窗环境 进入MATLAB之后,会看到一个视窗MATLAB Command Window称为指令视窗,它是你键入指令的地方同时 MATLAB也将计算结果显示在此。 1.2 简易计算 我们先从MATLAB的...