開始使用免費開始

使用 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)
編輯並執行程式碼