kmeans clustering and framework