You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# random reassignment: the choice is done as a function
# of the iteration index, and the minimum number of
# counts, in order to force this reassignment to happen
# every once in a while
random_reassign=((iteration_idx+1)
% (10+int(self.counts_.min())) ==0),
random_state=random_state,
reassignment_ratio=self.reassignment_ratio,
verbose=self.verbose)
I presume that if n_iter is 0, then the for loop at line 1583 will not be run, which makes the assignment useful. But for k-means is n_iter ever set to 0?
Note
I found this through lgtm.com, as recommended by #12167
Versions
0.20
The text was updated successfully, but these errors were encountered:
The variables batch_inertia and centers_squared_diff aren't used indeed. However, the function _mini_batch_step performs inplace operations on the centers for example, so it can't be removed.
We could instead do
Description
in
sklearn/cluster/k_means_.py
, line 1559:scikit-learn/sklearn/cluster/k_means_.py
Lines 1559 to 1563 in 2e2e69d
Are variables
batch_inertia
andcenters_squared_diff
actually used before being reassigned in line 1589?scikit-learn/sklearn/cluster/k_means_.py
Lines 1583 to 1603 in 2e2e69d
I presume that if
n_iter
is 0, then the for loop at line 1583 will not be run, which makes the assignment useful. But for k-means isn_iter
ever set to 0?Note
I found this through lgtm.com, as recommended by #12167
Versions
0.20
The text was updated successfully, but these errors were encountered: