ML之catboost:基于自定义数据集利用catboost 算法实现回归预测(训练采用CPU和GPU两种方式)

举报
一个处女座的程序猿 发表于 2022/03/16 22:35:55 2022/03/16
【摘要】 ML之catboost:基于自定义数据集利用catboost 算法实现回归预测(训练采用CPU和GPU两种方式) 目录 基于自定义数据集利用catboost 算法实现回归预测(训练采用CPU和GPU两种方式) 输出结果 # T1、训练采用CPU # T2、训练采用GPU 实现代码 基于自定义数据集利用...

ML之catboost:基于自定义数据集利用catboost 算法实现回归预测(训练采用CPU和GPU两种方式)

目录

基于自定义数据集利用catboost 算法实现回归预测(训练采用CPU和GPU两种方式)

输出结果

# T1、训练采用CPU

# T2、训练采用GPU

实现代码


基于自定义数据集利用catboost 算法实现回归预测(训练采用CPU和GPU两种方式)

输出结果

# T1、训练采用CPU


  
  1. 0: learn: 7.9608417 total: 50.2ms remaining: 1.46s
  2. 1: learn: 7.7618206 total: 50.5ms remaining: 707ms
  3. 2: learn: 7.5879985 total: 50.9ms remaining: 458ms
  4. 3: learn: 7.4148674 total: 51.4ms remaining: 334ms
  5. 4: learn: 7.2488388 total: 51.6ms remaining: 258ms
  6. 5: learn: 7.0676178 total: 51.8ms remaining: 207ms
  7. 6: learn: 6.8909273 total: 51.9ms remaining: 171ms
  8. 7: learn: 6.7186541 total: 52.1ms remaining: 143ms
  9. 8: learn: 6.5506878 total: 52.3ms remaining: 122ms
  10. 9: learn: 6.3869206 total: 52.4ms remaining: 105ms
  11. 10: learn: 6.2272476 total: 52.6ms remaining: 90.9ms
  12. 11: learn: 6.0715664 total: 52.8ms remaining: 79.2ms
  13. 12: learn: 5.9197772 total: 52.9ms remaining: 69.2ms
  14. 13: learn: 5.7717828 total: 53.1ms remaining: 60.7ms
  15. 14: learn: 5.6274882 total: 53.2ms remaining: 53.2ms
  16. 15: learn: 5.4868010 total: 53.4ms remaining: 46.7ms
  17. 16: learn: 5.3496310 total: 53.6ms remaining: 41ms
  18. 17: learn: 5.2158902 total: 53.7ms remaining: 35.8ms
  19. 18: learn: 5.0854930 total: 53.9ms remaining: 31.2ms
  20. 19: learn: 4.9583556 total: 54ms remaining: 27ms
  21. 20: learn: 4.8343967 total: 54.2ms remaining: 23.2ms
  22. 21: learn: 4.7135368 total: 54.4ms remaining: 19.8ms
  23. 22: learn: 4.5956984 total: 54.5ms remaining: 16.6ms
  24. 23: learn: 4.4808059 total: 54.7ms remaining: 13.7ms
  25. 24: learn: 4.3687858 total: 54.9ms remaining: 11ms
  26. 25: learn: 4.2595661 total: 55ms remaining: 8.46ms
  27. 26: learn: 4.1530770 total: 55.2ms remaining: 6.13ms
  28. 27: learn: 4.0492501 total: 55.3ms remaining: 3.95ms
  29. 28: learn: 3.9480188 total: 55.5ms remaining: 1.91ms
  30. 29: learn: 3.8493183 total: 55.7ms remaining: 0us
  31. [14.72696421 19.90303684]

# T2、训练采用GPU


  
  1. 0: learn: 7.9608417 total: 114ms remaining: 3.29s
  2. 1: learn: 7.7618210 total: 118ms remaining: 1.65s
  3. 2: learn: 7.5677758 total: 122ms remaining: 1.1s
  4. 3: learn: 7.3785819 total: 125ms remaining: 814ms
  5. 4: learn: 7.1941178 total: 128ms remaining: 642ms
  6. 5: learn: 7.0142648 total: 132ms remaining: 529ms
  7. 6: learn: 6.8389078 total: 136ms remaining: 446ms
  8. 7: learn: 6.6679348 total: 140ms remaining: 385ms
  9. 8: learn: 6.5012368 total: 143ms remaining: 335ms
  10. 9: learn: 6.3387062 total: 149ms remaining: 297ms
  11. 10: learn: 6.1802387 total: 153ms remaining: 264ms
  12. 11: learn: 6.0257332 total: 156ms remaining: 234ms
  13. 12: learn: 5.8750898 total: 162ms remaining: 212ms
  14. 13: learn: 5.7282121 total: 166ms remaining: 190ms
  15. 14: learn: 5.5850064 total: 171ms remaining: 171ms
  16. 15: learn: 5.4453814 total: 175ms remaining: 153ms
  17. 16: learn: 5.3092462 total: 180ms remaining: 137ms
  18. 17: learn: 5.1765153 total: 184ms remaining: 122ms
  19. 18: learn: 5.0471030 total: 188ms remaining: 109ms
  20. 19: learn: 4.9209255 total: 193ms remaining: 96.3ms
  21. 20: learn: 4.7979018 total: 196ms remaining: 84.2ms
  22. 21: learn: 4.6779541 total: 200ms remaining: 72.7ms
  23. 22: learn: 4.5610056 total: 204ms remaining: 62.1ms
  24. 23: learn: 4.4469804 total: 208ms remaining: 51.9ms
  25. 24: learn: 4.3358058 total: 212ms remaining: 42.5ms
  26. 25: learn: 4.2274105 total: 218ms remaining: 33.6ms
  27. 26: learn: 4.1217256 total: 223ms remaining: 24.8ms
  28. 27: learn: 4.0186824 total: 227ms remaining: 16.2ms
  29. 28: learn: 3.9182151 total: 230ms remaining: 7.95ms
  30. 29: learn: 3.8202597 total: 235ms remaining: 0us
  31. [14.67884178 20. ]

实现代码


  
  1. # ML之catboost:基于自定义数据集实现回归预测
  2. from catboost import CatBoostRegressor
  3. #1、定义数据集
  4. train_data = [[12, 14, 16, 18],
  5. [23, 25, 27, 29],
  6. [32, 34, 36, 38]]
  7. train_labels = [10, 20, 30]
  8. eval_data = [[2, 4, 6, 8],
  9. [20, 21, 24, 33]]
  10. #2、模型预测
  11. model_CatBR = CatBoostRegressor(iterations=30, learning_rate=0.1, depth=2)
  12. model_CatBR.fit(train_data, train_labels)
  13. preds = model_CatBR.predict(eval_data)
  14. print(preds)

文章来源: yunyaniu.blog.csdn.net,作者:一个处女座的程序猿,版权归原作者所有,如需转载,请联系作者。

原文链接:yunyaniu.blog.csdn.net/article/details/115711121

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。