Simple imputation
As you saw in the last exercise, deleting data can reduce your dataset by too much. In an interview context, this can lead to biased results of your machine learning model.
A more dynamic way of handling missing values is by imputing them. There are a variety of ways of doing this in python, but in this exercise you will be using the SimpleImputer()
function from the sklearn.impute
module on loan_data
.
You will then use pandas
and numpy
to convert the imputed dataset into a DataFrame.
Note that 2 steps are now added to the pipeline, Instantiate and Fit:
Diese Übung ist Teil des Kurses
Practicing Machine Learning Interview Questions in Python
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Import imputer module
from sklearn.impute import SimpleImputer
# Subset numeric features: numeric_cols
numeric_cols = ____.____(include=[____.____])