I'd like to find the best imputation method for missing data in Scikit-learn.
I have a dataset X and I have created an artificially corrupted version of it in X_na, so I can measure the qualities of different imputations. At this point I'm wondering if I could use sklearn's GridSearchCV to do the search over possible imputer versions like this:
imputer_pipeline = Pipeline([("imputer":SimpleImputer())]
params = [{"imputer":[SimpleImputer()]},
{"imputer":[IterativeImputer()]},
{"imputer":[KNNImputer()], "imputer__n_neighbors": [3, 5, 7]}]
imputer_grid = GridSearchCV(imputer_pipe, param_grid=params, scoring="mse", cv=5)
imputer_grid.fit(X_na, X)
But the problem is that imputer_grid.fit does'n channel X_na and X to the imputer pipeline, I cannot instruct it to compare the imputed X_na and X by scoring (mse). The pipeline must have some object with .fit() accepting both X and y.