Skip to content

Commit dc5d57d

Browse files
GaelVaroquauxlarsmans
authored andcommitted
ENH: Remove unused copy in k-means
One copy was done above the copy removed.
1 parent 7c2cd61 commit dc5d57d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

doc/whats_new.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
======
77

88

9+
Enhancements
10+
------------
11+
12+
- Minor performance improvements to k-means by `Gael Varoquaux`_.
13+
14+
915
Bug fixes
1016
---------
1117

sklearn/cluster/k_means_.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,7 @@ def k_means(X, n_clusters, init='k-means++', precompute_distances=True,
237237
if not sp.issparse(X) or hasattr(init, '__array__'):
238238
X_mean = X.mean(axis=0)
239239
if not sp.issparse(X):
240-
if copy_x:
241-
X = X.copy()
240+
# The copy was already done above
242241
X -= X_mean
243242

244243
if hasattr(init, '__array__'):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy