00schneider
00schneider

Reputation: 788

Correct code for imputation with fancyimpute

I was performing an imputation of missing values by KNN with this code:

1) data[missing] = KNN(k = 3, verbose = False).fit_transform(data[missing])

However, I saw some tutorials (e.g. Chris Albon - Machine Learning With Python Cookbook p. 78) that used the method .complete();

2) features_knn_imputed = KNN(k=5, verbose=0).complete(X_train[true_nums])

I was wondering if 2) is deprecated code or if my implementation of KNN for imputing in 1) is incorrect?

Upvotes: 0

Views: 221

Answers (1)

Sea
Sea

Reputation: 46

Yes, .complete is deprecated. Use .fit_transform just like sklearn.

Check the usage here: https://pypi.org/project/fancyimpute/0.5.5/

Upvotes: 1

Related Questions