开始使用免费开始使用

拟合逻辑回归模型

除了回归模型,parsnip 包还为 R 中的分类模型提供了通用接口。

在本练习中,您将定义一个 parsnip 逻辑回归对象,并训练模型,用 telecom_df 数据中的 avg_call_minsavg_intl_minsmonthly_charges 作为自变量来预测 canceled_service

上一节您创建的 telecom_trainingtelecom_test tibble 已加载到本会话中。

本练习是课程的一部分

在 R 中使用 tidymodels 建模

查看课程

交互式实操练习

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

# Specify a logistic regression model
logistic_model <- ___ %>% 
  # Set the engine
  ___ %>% 
  # Set the mode
  ___

# Print the model specification
logistic_model
编辑并运行代码