I want to get the two most probable labels for each sample in my X.
A little context: I am working on a clustering project where I have 1.6M samples that have to be clustered into 12 clusters. First, I did KMeans and it works fine, except that KMeans is a hard clusterer model so it only gives one exclusive label per sample. For my project, I need to get not one but the top 2 most probable labels, which is why I changed to Gaussian Mixture Model.
I was thinking of doing this by looking through the array of probabilities for each component per sample and find the 2 highest values and this way, assign the labels.
So two questions:
- How can I find the two highest values in an array and their location?
or.. if there is an easier way:
- How can I assign the top two labels to each sample?