开始使用免费开始使用

使用 SGB 进行回归

与上一课的练习一样,您将继续使用 Bike Sharing Demand 数据集。在接下来的练习中,您将使用随机梯度提升来解决这个自行车数量的回归问题。

本练习是课程的一部分

Python 树模型机器学习

查看课程

练习说明

  • 实例化一个随机梯度提升回归器(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)
编辑并运行代码