Reputation: 19
This error is cause due to following line
model = KMeans(n_clusters = k, n_jobs=8, max_iter = iteration).
And my sklearn version is 1.0.1. I remember the sklearn.cluster.KMeans has n_jobs parameter. Does the sklearn.cluster.KMeans have no parameter of n-jobs after updating?
Upvotes: 1
Views: 13338
Reputation: 15504
If you search for "sklearn kmeans", then the first result will be this official documentation page:
On that page, the first thing is the prototype, with the arguments and their default values:
sklearn.cluster.KMeans(n_clusters=8, *, init='k-means++', n_init=10, max_iter=300, tol=0.0001, verbose=0, random_state=None, copy_x=True, algorithm='auto')
No, there is no argument called n_jobs
.
There used to be an argument called n_jobs
, but it was deprecated in version 0.23, and is now removed: sklearn (0.24) .cluster.KMeans
Upvotes: 4
Reputation: 33127
n_jobs
input argument has been deprecated after 0.23 version. In the latest version, there is no such input argument.
Currently, it uses all cores by default. If you want to use a specific number of cores, you can set the OMP_NUM_THREADS environment variable (see details) or use the threadpoolctl package. Source
From the documentation:
n_jobsint, default=None
The number of OpenMP threads to use for the computation. Parallelism is sample-wise on the main cython loop which assigns each sample to its closest center.
None or -1 means using all processors.
Deprecated since version 0.23: n_jobs was deprecated in version 0.23 and will be removed in 1.0 (renaming of 0.25).
Upvotes: 3