比較並選出最佳的校正 R-squared
在以線性模型分析已插補的 DataFrame 時,校正 R-squared($adj.R^2$)用來衡量模型的擬合優度。
在這個練習中,你將比較先前為每個插補後資料集所建立的「線性模型」的 \(adj.R^2\) 分數,也就是 lm_mean、lm_KNN 和 lm_MICE。
你會先(透過建立一個 DataFrame)整齊列印它們的 rsquared_adj 屬性,最後選出 \(adj.R^2\) 最高的模型。
上述模型已替你載入為 lm_mean、lm_KNN 和 lm_MICE。
本練習屬於課程
在 Python 中處理遺漏值
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# 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)