@@ -86,7 +86,7 @@ def _labels_inertia_precompute_dense(norm, X, sample_weight, centers, distances)
86
86
87
87
88
88
def _labels_inertia (norm , X , sample_weight , centers ,
89
- precompute_distances = True , distances = None ):
89
+ precompute_distances = True ):
90
90
"""
91
91
E step of the K-means EM algorithm.
92
92
@@ -109,10 +109,6 @@ def _labels_inertia(norm, X, sample_weight, centers,
109
109
precompute_distances : boolean, default: True
110
110
Precompute distances (faster but takes more memory).
111
111
112
- distances : float array, shape (n_samples,)
113
- Pre-allocated array to be filled in with each sample's distance
114
- to the closest center.
115
-
116
112
Returns
117
113
-------
118
114
labels : int array of shape(n)
@@ -125,18 +121,17 @@ def _labels_inertia(norm, X, sample_weight, centers,
125
121
return _labels_inertia_skl (
126
122
X , sample_weight = sample_weight , centers = centers ,
127
123
precompute_distances = precompute_distances ,
128
- distances = distances , x_squared_norms = None )
124
+ x_squared_norms = None )
129
125
130
126
sample_weight = _check_normalize_sample_weight (sample_weight , X )
131
127
# set the default value of centers to -1 to be able to detect any anomaly
132
128
# easily
133
- if distances is None :
134
- distances = numpy .zeros (shape = (0 ,), dtype = X .dtype )
129
+ distances = numpy .zeros (shape = (0 ,), dtype = X .dtype )
135
130
# distances will be changed in-place
136
131
if issparse (X ):
137
132
raise NotImplementedError ( # pragma no cover
138
133
"Sparse matrix is not implemented for norm 'l1'." )
139
- elif precompute_distances :
134
+ if precompute_distances :
140
135
return _labels_inertia_precompute_dense (norm , X , sample_weight , centers , distances )
141
136
raise NotImplementedError ( # pragma no cover
142
137
"precompute_distances is False, not implemented for norm 'l1'." )
0 commit comments