擬合、增廣與評估
你已經可以把工作流程套用到訓練資料,並用測試切分來評估效能。
你的工作空間中已提供 embed 套件、lr_workflow_glm 物件,以及對應的 test 與 train 切分。
本練習屬於課程
R 的特徵工程
練習說明
- 將工作流程擬合到訓練集。
- 使用測試切分對擬合結果進行增廣。
- 評估模型。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Fit the workflow to the training set
lr_fit_glm <- lr_workflow_glm %>%
___(train)
# Augment the fit using the test split
lr_aug_glm <- lr_fit_glm %>%
___(test)
# Assess the model
glm_metrics <- lr_aug_glm %>%
class_evaluate(truth = ___,
estimate = .pred_class,
.pred_Yes)
glm_metrics