開始使用免費開始

精簡模型流程

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 %>% 
  ___
編輯並執行程式碼