I am working on the problem of speaker clustering. I am using k-means clustering. The ground truth cluster values and k-mean cluster values do not correspond due to different methods of labelling (manually labelled for ground truth and via scikit's k-means function). So I need to find all permutations of matching values and choose the matching values with the highest percentage of match/correctness. I have a ground truth npy array and a labels_by_kmeans npy array as shown below:

Ground truth

Ground truth

Labels by Kmeans

Labels by kmeans

As you can see, arrays 0 and 2 in both tables have 0s and 2s,3s that correspond to each other. However, in array 1 5s seems to corresponds to 0s. I am trying to find the best fit for 0s in ground truth in Labels by k-means.

How can I do this via code?


1 Answer 1


Implement the

Hungarian matching algorithm

It will find the best mapping.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.