资源简介
谱聚类matlab代码
代码片段和文件信息
function score = accuracy(true_labels cluster_labels)
%ACCURACY Compute clustering accuracy using the true and cluster labels and
% return the value in ‘score‘.
%
% Input : true_labels : N-by-1 vector containing true labels
% cluster_labels : N-by-1 vector containing cluster labels
%
% Output : score : clustering accuracy
% Compute the confusion matrix ‘cmat‘ where
% col index is for true label (CAT)
% row index is for cluster label (CLS).
n = length(true_labels);
cat = spconvert([(1:n)‘ true_labels ones(n1)]);
cls = spconvert([(1:n)‘ cluster_labels ones(n1)]);
cls = cls‘;
cmat = full(cls * cat);
%
% Calculate accuracy
%
[match cost] = hungarian(-cmat);
score = 100*(-cost/n);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-05-05 21:06 spectralclustering-1.1\
文件 750 2011-05-05 21:06 spectralclustering-1.1\accuracy.m
目录 0 2011-05-05 21:06 spectralclustering-1.1\data\
文件 2626906 2011-05-05 21:06 spectralclustering-1.1\data\corel_100_NN_sym_distance.mat
文件 258581 2011-05-05 21:06 spectralclustering-1.1\data\corel_10_NN_sym_distance.mat
文件 3982453 2011-05-05 21:06 spectralclustering-1.1\data\corel_150_NN_sym_distance.mat
文件 385884 2011-05-05 21:06 spectralclustering-1.1\data\corel_15_NN_sym_distance.mat
文件 5315835 2011-05-05 21:06 spectralclustering-1.1\data\corel_200_NN_sym_distance.mat
文件 515644 2011-05-05 21:06 spectralclustering-1.1\data\corel_20_NN_sym_distance.mat
文件 1297736 2011-05-05 21:06 spectralclustering-1.1\data\corel_50_NN_sym_distance.mat
文件 129836 2011-05-05 21:06 spectralclustering-1.1\data\corel_5_NN_sym_distance.mat
文件 1292947 2011-05-05 21:06 spectralclustering-1.1\data\corel_feature.mat
文件 236 2011-05-05 21:06 spectralclustering-1.1\data\corel_label.mat
文件 4020 2011-05-05 21:06 spectralclustering-1.1\gen_nn_distance.m
文件 9229 2011-05-05 21:06 spectralclustering-1.1\hungarian.m
文件 4309 2011-05-05 21:06 spectralclustering-1.1\k_means.m
文件 1645 2011-05-05 21:06 spectralclustering-1.1\nmi.m
文件 4759 2011-05-05 21:06 spectralclustering-1.1\nystrom.m
文件 4463 2011-05-05 21:06 spectralclustering-1.1\nystrom_no_orth.m
文件 8761 2011-05-05 21:06 spectralclustering-1.1\README
文件 2714 2011-05-05 21:06 spectralclustering-1.1\sc.m
文件 1267 2011-05-05 21:06 spectralclustering-1.1\sc
文件 2043 2011-05-05 21:06 spectralclustering-1.1\sc
文件 2059 2011-05-05 21:06 spectralclustering-1.1\sc
文件 2341 2011-05-05 21:06 spectralclustering-1.1\sc
文件 2371 2011-05-05 21:06 spectralclustering-1.1\sc
文件 9005 2012-12-31 20:44 read me.txt
- 上一篇:MATLAB在振动信号处理中应用
- 下一篇:MATLAB图像与视频处理详解代码
评论
共有 条评论