-
-
Notifications
You must be signed in to change notification settings - Fork 25.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KMeans not running in parallel when init='random' #12949
Comments
It looks like 40e6c43 made the incorrect change to k_means_.py. scikit-learn/sklearn/cluster/k_means_.py Line 370 in d300f40
== 1 .
|
Let me work on this, I just need some pointers on regression test. I found a existing test case checking for cpu count, should I write a test case similar to this. scikit-learn/sklearn/tests/test_multioutput.py Lines 168 to 177 in fa98a72
|
PR welcome. I don't think it would be easy to write a test, nor do I see it
as essential. But I expect at present that the else case is never executed
(the coverage drop might have been masked by the rest of that change), so a
solution might at least increase test coverage
|
Description
Dear all,
I experience a difference in behaviour of sklearn.cluster.KMeans when using init='random' or init='k-means++' in combination with n_jobs=-1 (or unequal 1). Not all CPUs are used when init='random', n_jobs=-1 and n_clusers>1. I monitored this with htop. For init='k-means++' this is not the case. Interestingly, this is happening only on Linux (tested Red Hat and Ubuntu, specified in the Versions section is Ubuntu). Another intersting note is, that the behaviour is not observable on my Windows machine, here monitored with Task manager.
Steps/Code to Reproduce
Expected Results
No difference regarding usage of cores between 'random' and 'k-means++'.
Actual Results
Only working for all cores with 'random' when n_clusters=1, otherwise only using one core. 'k-means++' is using all cores for any value of n_clusters.
Versions
Windows:
Linux:
The text was updated successfully, but these errors were encountered: