栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

【AI实战】XGBRegressor模型加速训练,使用GPU秒级训练XGBRegressor

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

【AI实战】XGBRegressor模型加速训练,使用GPU秒级训练XGBRegressor

XGBRegressor模型加速训练,使用GPU秒级训练XGBRegressor
  • 机器学习模型

      XGBRegressor
    
  • 环境

    • Ubuntu 18.04
    • python3.6.9
    • TensorFlow 2.4.2
    • cuda 11.0
    • xgboost 1.5.2
  • 核心代码

    x, y = load_data()
    model = xgb.XGBRegressor(learning_rate=0.05,
                             n_estimators=420,
                             max_depth=3,
                             min_child_weight=1,
                             gamma=0.0,
                             subsample=0.8,
                             colsample_bytree=0.8,
                             scale_pos_weight=0.8,
                             seed=42,
                             tree_method='gpu_hist',
                             gpu_id=3)
    
	output = model.fit(x, y)

在2百万级的数据上耗时 34.344 s:

real    0m34.344s
user    4m46.866s
sys     0m22.178s

其中,重要的参数:

	tree_method='gpu_hist'
	gpu_id=3 表示使用第3块gpu
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/958091.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号