简体   繁体   中英

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 (eg 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, .complete is deprecated. Use .fit_transform just like sklearn.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM