擬合邏輯斯迴歸模型
除了迴歸模型之外,parsnip 套件也在 R 中提供分類模型的通用介面。
在這個練習中,你將定義一個 parsnip 的邏輯斯迴歸物件,並訓練模型,使用 telecom_df 資料中的 avg_call_mins、avg_intl_mins 與 monthly_charges 作為預測變數,來預測 canceled_service。
你在前一個單元建立的 telecom_training 和 telecom_test tibbles 已載入至本次工作階段。
本練習屬於課程
在 R 中使用 tidymodels 建立模型
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Specify a logistic regression model
logistic_model <- ___ %>%
# Set the engine
___ %>%
# Set the mode
___
# Print the model specification
logistic_model