I have n
data points in some arbitrary space and I cluster them.
The result of my clustering algorithm is a partition represented by an int vector l
In matlab:
function tf = isIdenticalClust( l_1, l_2 )
%
% checks if partitions l_1 and l_2 are identical or not
%
tf = all( accumarray( {l_1} , l_2 , [],@(x) all( x == x(1) ) ) == 1 ) &&...
all( accumarray( {l_2} , l_1 , [],@(x) all( x == x(1) ) ) == 1 );
What this does:
groups all elements of l_1
according to the partition of l_2
and checks if all elements of l_1
at each cluster are all identical. Repeating the same for partitioning l_2
according to l_1
.
If both grouping yields the homogenous clusters - they are identical.