⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dosomtest.m

📁 有关聚类的一些例子
💻 M
字号:
function doSomTest
 proto = [
    0.6213    0.7373
    0.5226    0.8939
    0.9797    0.6614
    0.9568    0.0118
    0.8801    0.1991
    0.8757    0.0648 
    0.1730    0.2987
    0.2714    0.2844
    0.2523    0.4692
    ];
 protoClass = [
     1
     1
     1
     2
     2
     2 
     3
     3
     3
     ];
 data = [
    0.9883    0.4329
    0.5828    0.2259
    0.4235    0.5798
    0.5155    0.7604
    0.3340    0.5298 
    ];

 % main
 dataClass = doSom(data, proto, protoClass, 3);

 % plot proto
 figure(2);
 classLabel = unique(protoClass);
 nClass     = length(classLabel);
 plotLabel = {'r*', 'g*', 'b*'};
 for i=1:nClass
     A = proto(protoClass == classLabel(i), :);
     plot(A(:, 1), A(:, 2), plotLabel{i});
     hold on;
 end

 % plot data
 plotLabel = {'ro', 'go', 'bo'};
 for i=1:nClass
     A = data(dataClass == classLabel(i), :);
     plot(A(:, 1), A(:, 2), plotLabel{i});
     hold on;
 end
 legend('1: proto','2: proto', '3: proto', '1: data', '2: data', '3: data');
 title('Self-organizing Map');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -