#NEWLINE# def _k_means( self , data , n_clusters ) : #NEWLINE# #INDENT# if self . mini_batch : #NEWLINE# #INDENT# model = MiniBatchKMeans ( n_clusters , init = self . init , n_init = self . n_init , random_state = self . random_state ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# model = KMeans ( n_clusters , init = self . init , n_init = self . n_init , n_jobs = self . n_jobs , random_state = self . random_state ) #NEWLINE# #UNINDENT# model . fit ( data ) #NEWLINE# centroid = model . cluster_centers_ #NEWLINE# labels = model . labels_ #NEWLINE# return ( centroid , labels )