快速檢視模型配適狀況
在這個練習中,你會使用 glance() 來計算各國線性模型對資料的配適程度。
本練習屬於課程
Tidyverse 的 Machine Learning
練習說明
- 在
gap_models資料框中新增一個欄位(fit),放入每個模型的配適統計量,並將結果存成model_perf_nested。 - 使用
unnest()將此資料框簡化,解開每個模型的配適統計量,並存成model_perf。 - 最後,用
head()先看一下model_perf。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Extract the fit statistics of each model into data frames
model_perf_nested <- gap_models %>%
mutate(fit = map(model, ~___(.x)))
# Simplify the fit data frames for each model
model_perf <- model_perf_nested %>%
unnest(___)
# Look at the first six rows of model_perf
head(___)