Skip to content

Commit ff3cbfb

Browse files
committed
pep8
1 parent 41a58bd commit ff3cbfb

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

mlinsights/mlmodel/kmeans_l1.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def _labels_inertia_precompute_dense(norm, X, sample_weight, centers, distances)
8686

8787

8888
def _labels_inertia(norm, X, sample_weight, centers,
89-
precompute_distances=True, distances=None):
89+
precompute_distances=True):
9090
"""
9191
E step of the K-means EM algorithm.
9292
@@ -109,10 +109,6 @@ def _labels_inertia(norm, X, sample_weight, centers,
109109
precompute_distances : boolean, default: True
110110
Precompute distances (faster but takes more memory).
111111
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-
116112
Returns
117113
-------
118114
labels : int array of shape(n)
@@ -125,18 +121,17 @@ def _labels_inertia(norm, X, sample_weight, centers,
125121
return _labels_inertia_skl(
126122
X, sample_weight=sample_weight, centers=centers,
127123
precompute_distances=precompute_distances,
128-
distances=distances, x_squared_norms=None)
124+
x_squared_norms=None)
129125

130126
sample_weight = _check_normalize_sample_weight(sample_weight, X)
131127
# set the default value of centers to -1 to be able to detect any anomaly
132128
# easily
133-
if distances is None:
134-
distances = numpy.zeros(shape=(0,), dtype=X.dtype)
129+
distances = numpy.zeros(shape=(0,), dtype=X.dtype)
135130
# distances will be changed in-place
136131
if issparse(X):
137132
raise NotImplementedError( # pragma no cover
138133
"Sparse matrix is not implemented for norm 'l1'.")
139-
elif precompute_distances:
134+
if precompute_distances:
140135
return _labels_inertia_precompute_dense(norm, X, sample_weight, centers, distances)
141136
raise NotImplementedError( # pragma no cover
142137
"precompute_distances is False, not implemented for norm 'l1'.")

mlinsights/mlmodel/sklearn_testing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def test_sklearn_grid_search_cv(fct_model, X, y=None, sample_weight=None, **grid
239239
if y_train is None and w_train is None:
240240
clf.fit(X_train)
241241
else:
242-
clf.fit(X_train, y_train, w_train)
242+
clf.fit(X_train, y_train, w_train) # pylint: disable=E1121
243243
score = clf.score(X_test, y_test)
244244
ExtTestCase().assertIsInstance(score, float)
245245
return dict(model=clf, X_train=X_train, y_train=y_train, w_train=w_train,

0 commit comments

Comments
 (0)