Comparing and choosing the best adjusted R-squared
During the analysis of imputed DataFrames on a linear model, the adjusted R-squared(\(adj.R^2\)) score that explains the best fit model.
In this exercise, you will compare the \(adj.R^2\) scores of the linear models (for each of the imputed datasets) you created earlier, namely lm_mean
, lm_KNN
and lm_MICE
respectively.
You will first neatly print (by creating a DataFrame) their attributes rsquared_adj
and finally choose the model with maximum \(adj.R^2\).
The above models have already been loaded for you as lm_mean
, lm_KNN
and lm_MICE
.
This exercise is part of the course
Dealing with Missing Data in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Store the Adj. R-squared scores of the linear models
rsquared_df = pd.DataFrame({'Mean Imputation': ___,
'KNN Imputation': ___,
'MICE Imputation': ___},
index=['Adj. R-squared'])
# Neatly print the Adj. R-squared scores in the console
print(rsquared_df)