step_poly()
เมื่อมี baseline แล้ว ลองเปรียบเทียบประสิทธิภาพของโมเดลโดยเพิ่มการแปลงแบบพหุนามให้กับค่าตัวเลขทั้งหมด
ข้อมูล attrition_num โมเดล logistic regression lr_model ฟังก์ชัน class-evaluate() ที่กำหนดไว้แล้ว รวมถึงชุดข้อมูล train และ test ได้ถูกโหลดไว้ให้แล้ว
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Feature Engineering in R
คำแนะนำการฝึกหัด
- เพิ่มการแปลงแบบพหุนามให้กับตัวทำนายที่เป็นตัวเลขทั้งหมด
- Fit workflow กับข้อมูล train
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
lr_recipe_poly <-
recipe(Attrition ~., data = train) %>%
# Add a polynomial transformation to all numeric predictors
___
lr_workflow_poly <- workflow() %>%
add_model(lr_model) %>%
add_recipe(lr_recipe_poly)
# Fit workflow to the train data
lr_fit_poly <- ___ %>% fit(train)
lr_aug_poly <- lr_fit_poly %>% augment(test)
lr_aug_poly %>% class_evaluate(truth = Attrition, estimate = .pred_class,.pred_No)