【问题标题】:How to generate fixed cluster of Fuzzy C mean in matlab如何在matlab中生成固定的模糊C均值簇
【发布时间】:2014-01-31 17:18:33
【问题描述】:

我在 matlab (ref code) 中使用 FCM 库代码。要生成分区矩阵,我们可以使用

 MF=initfcm(ncluster,imgsiz); %imgsiz is size of input image

其中 initfcm 是 Matlab 库中的函数:

function U = initfcm(cluster_n, data_n)
%INITFCM Generate initial fuzzy partition matrix for fuzzy c-means clustering.
%   U = INITFCM(CLUSTER_N, DATA_N) randomly generates a fuzzy partition
%   matrix U that is CLUSTER_N by DATA_N, where CLUSTER_N is number of
%   clusters and DATA_N is number of data points. The summation of each
%   column of the generated U is equal to unity, as required by fuzzy
%   c-means clustering.
%
%       See also DISTFCM, FCMDEMO, IRISFCM, STEPFCM, FCM.

%   Roger Jang, 12-1-94.
%   Copyright 1994-2002 The MathWorks, Inc. 
%   $Revision: 1.11 $  $Date: 2002/04/14 22:21:58 $

U = rand(cluster_n, data_n);
col_sum = sum(U);
U = U./col_sum(ones(cluster_n, 1), :);

我们可以看到模糊分区矩阵是随机创建的,因此结果不是由时间差来固定的,这意味着它将取决于聚类矩阵。如何创建具有不同时间的固定输出?

谢谢

【问题讨论】:

    标签: matlab image-processing


    【解决方案1】:

    在调用rand之前需要设置随机数生成器的状态:

    rng('default'); % add this
    U = rand( cluster_n, data_n );
    

    更多详情,请参阅third example here

    【讨论】:

      猜你喜欢
      • 2021-11-05
      • 1970-01-01
      • 2012-03-19
      • 1970-01-01
      • 2018-08-19
      • 1970-01-01
      • 2017-08-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多