拟合最佳与最差的模型
在本练习中,您将回答以下问题:
- 整体来看,您的模型对数据的拟合程度如何?
- 哪些是拟合最好的模型?
- 哪些模型对数据的拟合较差?
本练习是课程的一部分
Tidyverse 中的机器学习
练习说明
- 绘制 77 个模型的 \(R^2\) 直方图。
- 提取基于 \(R^2\) 的 4 个拟合最好的模型,并将该数据框保存为
best_fit。 - 提取基于 \(R^2\) 的 4 个拟合最差的模型,并将该数据框保存为
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 = ___)