开始使用免费开始使用

精简建模流程

last_fit() 函数用于在 tidymodels 中精简建模工作流。与其先在训练数据上训练模型,再使用测试数据构建结果 tibble,last_fit() 可用一个函数完成上述步骤。

在本练习中,您将使用与前面练习相同的逻辑回归模型,但这次通过 last_fit() 来训练。

您的数据切分对象 telecom_split 和模型规范 logistic_model 已加载到当前会话中。

本练习是课程的一部分

在 R 中使用 tidymodels 建模

查看课程

练习说明

  • 将您的 logistic_model 对象传入 last_fit() 函数。
  • 使用 avg_call_minsavg_intl_minsmonthly_charges 预测 canceled_service
  • 显示已训练模型 telecom_last_fit 的性能度量。

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Train model with last_fit()
telecom_last_fit <- ___ %>% 
  last_fit(___,
           split = ___)

# View test set metrics
telecom_last_fit %>% 
  ___
编辑并运行代码