最佳與最差擬合的模型
在這個練習中,你將回答以下問題:
- 整體而言,你的模型對資料的擬合程度如何?
- 哪些是擬合度最好的模型?
- 哪些模型對資料的擬合不佳?
本練習屬於課程
Tidyverse 的 Machine Learning
練習說明
- 繪製 77 個模型的 \(R^2\) 值直方圖。
- 擷取 4 個擬合度最好的模型(以 \(R^2\) 為依據),並將此資料框存為
best_fit。 - 擷取 4 個擬合度最差的模型(以 \(R^2\) 為依據),並將此資料框存為
worst_fit。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Plot a histogram of rsquared for the 77 models
model_perf %>%
ggplot(aes(x = ___)) +
___()
# Extract the 4 best fitting models
best_fit <- model_perf %>%
slice_max(___, n = ___)
# Extract the 4 models with the worst fit
worst_fit <- model_perf %>%
slice_min(___, n = ___)