@@ -1209,6 +1209,11 @@ def fit(self, X, y=None):
12091209 X [minibatch_indices ], x_squared_norms [minibatch_indices ],
12101210 self .cluster_centers_ , self .counts_ ,
12111211 old_center_buffer , tol > 0.0 , distances = distances ,
1212+ # Here we randomly choose whether to perform
1213+ # random reassignment: the choice is done as a function
1214+ # of the iteration index, and the minimum number of
1215+ # counts, in order to force this reassignment to happen
1216+ # every once in a while
12121217 random_reassign = (iteration_idx + 1 ) % (10 +
12131218 self .counts_ .min ()) == 0 ,
12141219 random_state = self .random_state ,
@@ -1261,8 +1266,8 @@ def partial_fit(self, X, y=None):
12611266 random_reassign = False
12621267 else :
12631268 # The lower the minimum count is, the more we do random
1264- # reassignement , however, we don't want to do random
1265- # reassignement too often, to allow for building up counts
1269+ # reassignment , however, we don't want to do random
1270+ # reassignment too often, to allow for building up counts
12661271 random_reassign = self .random_state .randint (10 * (1 +
12671272 self .counts_ .min ())) == 0
12681273
0 commit comments