added method to determine an optimal cluster size for kmeans