เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Baseline

ต่อเนื่องจากชุดข้อมูล attrition_num คราวนี้จะสร้าง baseline โดยใช้ recipe แบบพื้นฐาน เพื่อประเมินผลของขั้นตอน feature engineering เพิ่มเติม ข้อมูล attrition_num โมเดล logistic regression lr_model ฟังก์ชัน class_evaluate() ที่กำหนดเอง รวมถึงชุดข้อมูล train และ test ได้ถูกโหลดไว้ให้แล้ว

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Feature Engineering in R

ดูคอร์ส

คำแนะนำการฝึกหัด

  • รวมโมเดลและ recipe เข้าด้วยกันใน workflow
  • ใช้ฟังก์ชัน augment กับ workflow ที่ fit แล้ว เพื่อเตรียมพร้อมสำหรับการประเมินผล

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

lr_recipe_plain <- recipe(Attrition ~., data = train)

# Bundle the model and recipe
lr_workflow_plain <- workflow() %>%
  ___(lr_model) %>%
  ___(lr_recipe_plain)
lr_fit_plain <- lr_workflow_plain %>%
  fit(train)

# Augment the fit workflow
lr_aug_plain <- lr_fit_plain %>%
  ___(___)
lr_aug_plain %>%
  class_evaluate(truth = Attrition,estimate = .pred_class,
                 .pred_No)
แก้ไขและรันโค้ด