using the kmeans to find the centroid matrix. the value of the centroid matrix is 2x419 kmeans clustered it into the 2 groups ie) 2x419= 1x419 is one group & another 1x419 is another group. Next step i give new 1x419 matrix to calculate which group is nearer. How to find which group is nearer?
I'm not really sure what you mean by the centroid matrix. Do you have 419 (x,y) coordinates of centroids? Or do you have only 2 centroids? Are the 419 points actually data points, not centroids? Did you use k = 2 to cluster those 419 data points into 2 clusters, each with a centroid so that you have 2 centroids, not 419?
Assuming 2 clusters and 419 training points, you can find a generalized distance which is like a z score which is the number of standard deviations away from the centroid. So a "big" cluster would have more "pull" on determining which cluster an arbitrary point belonged to than a "small" compact cluster. So just calculate the centroid and average distance from the centroid for the two clusters. Then do it for your arbitrary point and figure out which generalized distance is lower - that's the cluster your point belongs to (should be assigned to).
Play games and win prizes!Learn more