int max = 0, id = 0;
int indx= 0;
vector<int> clusters(k,0);
for (size_t i = 0; i < bestLabels.size(); i++)
{
id = bestLabels[i];
clusters[id]++;
if (clusters[id] > max)
{
max = clusters[id];
indx = id;
}
}
This code calculates for the largest cluster through K-Means Clustering but i don't quite understand how "clusters[id]++;" and "cluster[id]" work. What do they do exactly? Can anyone please give a detailed explanation on the process happening inside the for loop? Any help would be highly appreciated. Thank you!