開始使用免費開始

擬合邏輯斯迴歸模型

除了迴歸模型之外,parsnip 套件也在 R 中提供分類模型的通用介面。

在這個練習中,你將定義一個 parsnip 的邏輯斯迴歸物件,並訓練模型,使用 telecom_df 資料中的 avg_call_minsavg_intl_minsmonthly_charges 作為預測變數,來預測 canceled_service

你在前一個單元建立的 telecom_trainingtelecom_test tibbles 已載入至本次工作階段。

本練習屬於課程

在 R 中使用 tidymodels 建立模型

檢視課程

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

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

# Print the model specification
logistic_model
編輯並執行程式碼