[Solved] What does this code snippet do exactly?

The following line: vector<int> clusters(k,0); Defines a random-access collection of k total integers each with an initial value of 0. clusters[id] accesses the integer value stored at index id in the vector. clusters[id]++ increments the integer value stored at index id. This works because operator [] on a vector returns a reference to the indexed … Read more

[Solved] Understanding kmeans clustering in r [closed]

1. What does the cluster sizes mean? You provided 16 records and told kmeans to find 3 clusters. It clustered those 16 records into 3 groups of A: 3 records, B: 10 records and C: 3 records. 2. What are the cluster means? These numbers signify the location in N-Dimensional space of the centroid (the … Read more

[Solved] How to cluster with K-means, when number of clusters and their sizes are known [closed]

It won’t be k-means anymore. K-means is variance minimization, and it seems your objective is to produce paritions of a predefined size, not of minimum variance. However, here is a tutorial that shows how to modify k-means to produce clusters of the same size. You can easily extend this to produce clusters of the desired … Read more