BUG? evalclusters is sensitive to rows (points) order
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dear All,
I have noticed that Silhouette Criterion evaluation (evalcluster) of clustering gives different results for different points order ! This does not make any sense in my opinion.
I guess row order in matrix should have no impact on criterion value.
clear; close all; clc;
N = 100;
D = 2;
klist = 1:25;
% original points
rng(1)
X = rand(N,D);
% shuffeled points order
rng(1)
X_sh = X(randperm(N), :);
%X_sh = X(sort(randperm(N)), :); % uncomment to control test
%% Silhoeutte test
for k = 1:length(klist)
%% no-shuffle
rng(1)
E = evalclusters(X, 'kmeans', 'silhouette', 'klist', klist(k), 'Distance', 'cosine');
%% shuffle
rng(1)
E_sh = evalclusters(X_sh, 'kmeans', 'silhouette', 'klist', klist(k), 'Distance', 'cosine');
Crit(k) = E.CriterionValues;
Crit_sh(k) = E_sh.CriterionValues;
end
clc
Crit
Crit_sh
%% (optional) Histogram to visualize
figure
bar(Crit, 'm')
hold on
bar(Crit_sh)
legend({'original' 'shuffled'}, 'Location', 'best'); title 'Silhouette criterion value'; xlabel 'Number of clusters'; xticks(klist); ylabel 'Value'; grid on;
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Cluster Visualization and Evaluation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!