CommencerCommencer gratuitement

Iterative imputation

In the previous exercise, you derived mean imputations for missing values of loan_data. However, in a machine learning interview, you will probably be asked about more dynamic imputation techniques that rely on other features in the dataset.

In this exercise, you'll practice a machine-learning based approach by imputing missing values as a function of remaining features using IterativeImputer() from sklearn.impute. This is a multivariate imputer that estimates each feature from all of the others in a 'round-robin' fashion.

Note that this function is considered experimental, so please read the documentation for more information.

You're at the same place in the Pipeline:

Machine learning pipeline

Cet exercice fait partie du cours

Practicing Machine Learning Interview Questions in Python

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Explicitly require this experimental feature
from sklearn.experimental import enable_iterative_imputer
# Now you can import normally from sklearn.impute
from sklearn.impute import IterativeImputer

# Subset numeric features: numeric_cols
numeric_cols = ____.____(____=[____.____])
Modifier et exécuter le code