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?
Yes,
.completeis deprecated. Use.fit_transformjust like sklearn.Check the usage here: https://pypi.org/project/fancyimpute/0.5.5/