MATLAB,波形簇分类源码程序 - matlab算法设计 - 谷速源码
下载频道> 资源分类> matlab源码> 算法设计> MATLAB,波形簇分类源码程序

标题:MATLAB,波形簇分类源码程序
分享到:

所属分类: 算法设计 资源类型: 文件大小: 90.96 KB 上传时间: 2016-01-27 18:10:17 下载次数: 7 资源积分:1分 提 供 者: 马云 点击下载
内容:
MATLAB,波形簇分类源码程序,程序员在编程的过程中可以参考学习使用,希望对IT程序员有用,此源码程序简单易懂、方便阅读,有很好的学习价值!
% Demonstration of the Modified Dunn's cluster validity index.
clc;
fprintf(1,'Cluster validation using modified Dunn''s index.\n');
fprintf(1,'--------------------------------------------------------\n');
 
%% Load dataset.
dataName = 'Wave';
load(['datasets\',dataName,'.mat']);
[n,d]=size(data);
fprintf(1,'Dataset %s loaded!\nSamples: %d, features: %d.\n',dataName,n,d);
fprintf(1,'--------------------------------------------------------\n');
 
%% Cluster the data. 
% Utilize hierarchical single-linkage algorithm with Euclidean distance. 
% Number of clusters: from 2 to maxK.
% maxK = ceil(sqrt(n));
maxK = 9;
labels = zeros(n,maxK-1);
 
% Single-linkage clustering algorithm (from the Statistics toolbox).
fprintf(1,['Performing single-linkage clustering for k=2-',num2str(maxK),...
                                                          '  [']);
D=pdist(data,'euclidean');
htree=linkage(D,'single');
 
for k = 2:maxK
    % Store labels.
    labels(:,k-1)=cluster(htree,k);
    fprintf(1,'.');
end
fprintf(1,']\n');
 
 
% Plot clustering results.
fprintf(1,'Clustering results are shown in figure.\n');
fprintf(1,'--------------------------------------------------------\n');
options_SP.title=['Clusterings of ', dataName, ' with SL'];
options_SP.subtitle=num2cell(2:maxK);
options_SP.markerSize = 5;
scatterPlot(data,labels,options_SP);
 
%% Validate the clusterings with internal indices.
% Compare Modified Dunn's index to generalized version (Pal & Biswas, 1997)
 
% Construct a neighborhood graph on data points
% Choose type of graph: 'rng', 'gabriel', 'directedKnn', 'mutualKnn',
% 'symKnn', 'EMST' or 'epsilon'.
graph_type = 'gabriel';
isDirected = 0; % set to 1 when using directed graph, e.g. directedKnn
options.show = 0; % set it to 1 to enable plotting of a graph
 
fprintf(1,'Creating %s graph on data points ... ', graph_type);
[G,d,uniqueInd]=graph_create(data,[],graph_type,options);
if ~isempty(uniqueInd)
    data = data(uniqueInd,:);
    labels = labels(uniqueInd,:);
end
fprintf('done!\n');
 
fprintf(1,'Validating results with internal indices        [');
 
DNg = zeros(1,maxK-1);
DNs = zeros(1,maxK-1);
 
for k = 1:maxK-1
    %   -> generalized Dunn's index (Pal & Biswas, 1997)
    DNg(k) = indexDNg_graph(G,labels(:,k),data);
    
    %   -> modified Dunn's index (Ilc, 2012)
    DNs(k) = indexDNs_graph(G,labels(:,k),isDirected);
    
    % SLOWER: alternative calls, when graph G is not pre-computed
    %DNs(k) = indexDNg(data,labels(:,k),graph_type,options);
    %DNs(k) = indexDNs(data,labels(:,k),graph_type,options);
    
    fprintf(1,'.');
end
fprintf(1,']\n');
 
% find maximum index value
[val_g,ind_g]=max(DNg);
[val_s,ind_s]=max(DNs);
 
figure();
subplot(2,1,1); plot(2:maxK, DNg,'.-k');hold on; plot(ind_g+1,val_g,'sr');
title('Generalized Dunn''s index');
xlabel('number of clusters'); ylabel('index value');
 
subplot(2,1,2); plot(2:maxK, DNs,'.-k');hold on; plot(ind_s+1,val_s,'sr');
title('Modified Dunn''s index');
xlabel('number of clusters'); ylabel('index value');
 
fprintf(1,'Values of validation indices are shown in figure.\n');
fprintf(1,'Optimal number of clusters is indicated with red square.\n');
fprintf(1,'--------------------------------------------------------\n');
 

文件列表(点击上边下载按钮,如果是垃圾文件请在下面评价差评或者投诉):

MATLAB,波形簇分类源码程序/
MATLAB,波形簇分类源码程序/indexDunnMod/
MATLAB,波形簇分类源码程序/indexDunnMod/datasets/
MATLAB,波形簇分类源码程序/indexDunnMod/README.txt
MATLAB,波形簇分类源码程序/indexDunnMod/datasets/Flag.csv
MATLAB,波形簇分类源码程序/indexDunnMod/datasets/Flag.mat
MATLAB,波形簇分类源码程序/indexDunnMod/datasets/Moon.csv
MATLAB,波形簇分类源码程序/indexDunnMod/datasets/Moon.mat
MATLAB,波形簇分类源码程序/indexDunnMod/datasets/Ring.csv
MATLAB,波形簇分类源码程序/indexDunnMod/datasets/Ring.mat
MATLAB,波形簇分类源码程序/indexDunnMod/datasets/Spiral.csv
MATLAB,波形簇分类源码程序/indexDunnMod/datasets/Spiral.mat
MATLAB,波形簇分类源码程序/indexDunnMod/datasets/Wave.csv
MATLAB,波形簇分类源码程序/indexDunnMod/datasets/Wave.mat
MATLAB,波形簇分类源码程序/indexDunnMod/demo.m
MATLAB,波形簇分类源码程序/indexDunnMod/dist_euclidean.m
MATLAB,波形簇分类源码程序/indexDunnMod/graph_EMST.m
MATLAB,波形簇分类源码程序/indexDunnMod/graph_create.m
MATLAB,波形簇分类源码程序/indexDunnMod/graph_directedKnn.m
MATLAB,波形簇分类源码程序/indexDunnMod/graph_epsilon.m
MATLAB,波形簇分类源码程序/indexDunnMod/graph_gabriel.m
MATLAB,波形簇分类源码程序/indexDunnMod/graph_mutualKnn.m
MATLAB,波形簇分类源码程序/indexDunnMod/graph_rng.m
MATLAB,波形簇分类源码程序/indexDunnMod/graph_symmetricKnn.m
MATLAB,波形簇分类源码程序/indexDunnMod/indexDNg.m
MATLAB,波形簇分类源码程序/indexDunnMod/indexDNg_graph.m
MATLAB,波形簇分类源码程序/indexDunnMod/indexDNs.m
MATLAB,波形簇分类源码程序/indexDunnMod/indexDNs_graph.m
MATLAB,波形簇分类源码程序/indexDunnMod/putbnd.m
MATLAB,波形簇分类源码程序/indexDunnMod/putbnds.m
MATLAB,波形簇分类源码程序/indexDunnMod/scatterPlot.m

关键词: 波形 源码 程序

Top_arrow
回到顶部
联系方式| 版权声明| 招聘信息| 广告服务| 银行汇款| 法律顾问| 兼职技术| 付款方式| 关于我们|
网站客服网站客服 程序员兼职招聘 程序员兼职招聘
沪ICP备19040327号-3
公安备案号:沪公网安备 31011802003874号
库纳格流体控制系统(上海)有限公司 版权所有
Copyright © 1999-2014, GUSUCODE.COM, All Rights Reserved