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

การถดถอยด้วย SGB

เช่นเดียวกับแบบฝึกหัดในบทเรียนที่ผ่านมา คุณจะทำงานกับชุดข้อมูล Bike Sharing Demand ในชุดแบบฝึกหัดนี้ จะได้แก้ปัญหาการถดถอยเพื่อพยากรณ์จำนวนจักรยานโดยใช้ stochastic gradient boosting

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

Machine Learning with Tree-Based Models in Python

ดูคอร์ส

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

  • สร้าง Stochastic Gradient Boosting Regressor (SGBR) และกำหนดค่าต่อไปนี้:

    • max_depth เป็น 4 และ n_estimators เป็น 200,

    • subsample เป็น 0.9 และ

    • max_features เป็น 0.75

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

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

# Import GradientBoostingRegressor
from sklearn.ensemble import GradientBoostingRegressor

# Instantiate sgbr
sgbr = ____(max_depth=____, 
            subsample=____,
            max_features=____,
            n_estimators=____,
            random_state=2)
แก้ไขและรันโค้ด