Speaker clustering/diarization 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



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?
Implement the

Hungarian matching algorithm

It will find the best mapping.