# kmeans

1. ### How can I get the data-points from the cluster with smallest within-variance in kmeans?

I have a kmeans object km <- kmeans(data, centers = k) The values of the within cluster variances can be found in km$withinss, and the smallest one is min(km$withinss). My question is how can I extract the data-points from this minimum cluster? I tried data[km$withinss == min(km$withinss)]...
2. ### Correct calculation of BIC (Bayesian Information Criterion) to determine K for K-Means

I am trying to calculate BIC in python. In python, there is no inbuilt library for computing BIC. I referenced the following link to compute variance and BIC further:-...
3. ### Kmeans clustering

Every time I run the same calculation with the same number of cluster setting, I got different members in the cluster. What is the most reasonable way to define the number of clusters? Or how should make the result reproducible?