• 大小: 12KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-20
  • 语言: Matlab
  • 标签: 模糊聚类  

资源简介

FCM模糊局问题,自带数据 文件:clust_denormalize.m;clust_normalize.m;clusteval.m;FCMclust.m;FuzSam.m等

资源截图

代码片段和文件信息

function eval = clusteval(newresultparam)

v = result.cluster.v;
c = size(result.cluster.v1);%c = param.c;
if exist(‘param.m‘)==1 m = param.m;else m = 2;end;
 
X=new.X;
[Nn] = size(X);
X1 = ones(N1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
if isfield(result.cluster‘M‘)%GK
    M = result.cluster.M;
    for j = 1 : c
        xv = X - X1*v(j:);
        d(:j) = sum((xv*M(::j).*xv)2);
    end
    distout=sqrt(d);
    %Update the partition matrix
    d = (d+1e-10).^(-1/(m-1));
    f0 = (d ./ (sum(d2)*ones(1c)));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
elseif isfield(result.cluster‘P‘)%GG
    A = result.cluster.P;
    f = result.data.f; 
    fm = f.^m;
    for j = 1 : c                        
        xv = X - X1*v(j:);
        Pi(::j)=1/N*sum(fm(:j));
        A = result.cluster.P(::j);
        d(:j) = 1/(det(pinv(A))^(1/2))*1/Pi(::j)*exp(1/2*sum((xv*pinv(A).*xv)2));
    end
    distout=sqrt(d);  
    %Update the partition matrix
    if m>1
          d = (d+1e-10).^(-1/(m-1));
      else
          d = (d+1e-10).^(-1);
      end    
    f0 = (d ./ (sum(d2)*ones(1c)));

else        %FCM
     for j = 1 : c
      xv = X - X1*v(j:);
      d(:j) = sum((xv*eye(n).*xv)2);
    end;
    distout=sqrt(d);
    d = (d+1e-10).^(-1/(m-1));
    f0 = (d ./ (sum(d2)*ones(1c)));
end
%results
    eval.d = distout;
    eval.f = f0;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Visualization

if n == 2   %in 2dimensional case draw a contour map
    lower1=min(X(:1));upper1=max(X(:1));scale1=(upper1-lower1)/200;
    lower2=min(X(:2));upper2=max(X(:2));scale2=(upper2-lower2)/200;
    [xy] = meshgrid(lower1:scale1:upper1 lower2:scale2:upper2);
    pair = [x(:) y(:)];
    [pair1pair2] = size(pair);
    X1 = ones(pair11);
    d=zeros(pair1c);  %resize the distance matrix
    
    
    if isfield(result.cluster‘M‘)%GK
        for j = 1 : c
            xv = pair - X1*v(j:);
            d(:j) = sum((xv*M(::j).*xv)2);
        end
        distout=sqrt(d);
        d = (d+1e-10).^(-1/(m-1));
        f0 = (d ./ (sum(d2)*ones(1c)));
        
    elseif isfield(result.cluster‘P‘)%GG
        for j = 1 : c                        
            xv = pair - X1*v(j:);
            Pi(::j)=1/N*sum(fm(:j));
            A = result.cluster.P(::j);
            d(:j) = 1/(det(pinv(A))^(1/2))*1/Pi(::j)*exp(1/2*sum((xv*pinv(A).*xv)2));
        end
        distout=sqrt(d);  
        if m>1
            d = (d+1e-10).^(-1/(m-1));
        else
            d = (d+1e-10).^(-1);
        end    
        f0 = (d ./ (sum(d2)*ones(1c)));
    else   %FCM
        for i = 1 : c
            xv = pair - ones(pair11)*v(i:);
            d(:i)= sum((xv*eye(2).*xv)2);%
        end;
        distout=sqrt(d);
     

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       3178  2005-03-22 15:59  FUZZCLUST\clusteval.m

     文件        710  2005-03-22 16:02  FUZZCLUST\clust_denormalize.m

     文件        705  2005-03-22 16:01  FUZZCLUST\clust_normalize.m

     文件       1483  2005-03-22 16:03  FUZZCLUST\FCMclust.m

     文件       2441  2005-03-22 15:35  FUZZCLUST\FuzSam.m

     文件       2553  2005-03-30 13:25  FUZZCLUST\GGclust.m

     文件       3112  2005-03-30 13:25  FUZZCLUST\GKclust.m

     文件       1957  2005-03-22 16:06  FUZZCLUST\Kmeans.m

     文件       2308  2005-03-22 16:07  FUZZCLUST\Kmedoid.m

     文件        379  2004-05-06 10:24  FUZZCLUST\nDexample.m

     文件       1353  2004-05-10 13:36  FUZZCLUST\PCA.m

     文件       1174  2005-03-22 16:10  FUZZCLUST\PROJEVAL.M

     文件       4509  2005-03-22 15:19  FUZZCLUST\SAMMON.M

     文件        610  2004-05-10 14:12  FUZZCLUST\SAMSTR.M

     文件       4101  2004-05-13 14:49  FUZZCLUST\validity.m

     目录          0  2010-11-17 19:56  FUZZCLUST

----------- ---------  ---------- -----  ----

                30573                    16


评论

共有 条评论