user3668129
user3668129

Reputation: 4820

How to use KNNImputer in parallel?

Can we use KNNImputer in parallel ? (i.e n_jobs=-1 like other sklearn modules) ?

I have a dataframe with 20 rows (features) and some of them contains nan.

Instead of using KNNImputer in sequential way (compute the value of each nan in row), can we do it in parallel ? (like n_jobs = -1) ?

my code for the sequential way looks:

imputer = KNNImputer(n_neighbors=5, weights="uniform", copy=False)
X_new = imputer.fit_transform(X, y)

How can we change it to impute in parallel ?

Upvotes: 2

Views: 1023

Answers (1)

Mourad Hegazy
Mourad Hegazy

Reputation: 47

you couldn't use multiprocessing with KNNImputer and you can check this thread https://github.com/scikit-learn/scikit-learn/issues/18186

Upvotes: 1

Related Questions