ML之xgboost:利用xgboost算法(sklearn+3Split+调参曲线)训练mushroom蘑菇数据集(22+1,6513+1611)来预测蘑菇是否毒性(二分类预测)


云海麒麟
云海麒麟 2022-09-19 14:44:53 66011
分类专栏: 资讯

ML之xgboost:利用xgboost算法(sklearn+3Split+调参曲线)训练mushroom蘑菇数据集(22+1,6513+1611)来预测蘑菇是否毒性(二分类预测)

目录

输出结果

设计思路

核心代码

更多输出


输出结果

设计思路

核心代码

  1. eval_set = [(X_train_part, y_train_part), (X_validate, y_validate)]
  2. bst.fit(X_train_part, y_train_part, eval_metric=["error", "logloss"], eval_set=eval_set, verbose=True)
  3. preds = bst.predict(X_test)
  4. predictions = [round(value) for value in preds]
  5. test_accuracy = accuracy_score(y_test, predictions)
  6. print("【max_depth=2,lr=0.1】Test Accuracy: %.2f%%" % (test_accuracy * 100.0))
  7. results = bst.evals_result()

更多输出

  1. X_train: (6513, 126)
  2. X_test: (1611, 126)
  3. After split(33%),X_train_part: (4363, 126)
  4. After split(33%),X_validate: (2150, 126)
  5. [0] validation_0-error:0.045611 validation_0-logloss:0.614637 validation_1-error:0.048372 validation_1-logloss:0.615401
  6. [1] validation_0-error:0.041256 validation_0-logloss:0.549907 validation_1-error:0.042326 validation_1-logloss:0.550696
  7. [2] validation_0-error:0.045611 validation_0-logloss:0.49543 validation_1-error:0.048372 validation_1-logloss:0.496777
  8. [3] validation_0-error:0.041256 validation_0-logloss:0.449089 validation_1-error:0.042326 validation_1-logloss:0.450412
  9. [4] validation_0-error:0.041256 validation_0-logloss:0.409231 validation_1-error:0.042326 validation_1-logloss:0.410717
  10. [5] validation_0-error:0.041256 validation_0-logloss:0.373748 validation_1-error:0.042326 validation_1-logloss:0.375653
  11. [6] validation_0-error:0.023378 validation_0-logloss:0.343051 validation_1-error:0.023256 validation_1-logloss:0.344738
  12. [7] validation_0-error:0.041256 validation_0-logloss:0.315369 validation_1-error:0.042326 validation_1-logloss:0.317409
  13. [8] validation_0-error:0.041256 validation_0-logloss:0.290912 validation_1-error:0.042326 validation_1-logloss:0.292587
  14. [9] validation_0-error:0.023378 validation_0-logloss:0.269356 validation_1-error:0.023256 validation_1-logloss:0.271103
  15. [10] validation_0-error:0.00573 validation_0-logloss:0.249593 validation_1-error:0.006512 validation_1-logloss:0.251354
  16. [11] validation_0-error:0.01719 validation_0-logloss:0.228658 validation_1-error:0.017674 validation_1-logloss:0.230144
  17. [12] validation_0-error:0.01719 validation_0-logloss:0.210442 validation_1-error:0.017674 validation_1-logloss:0.21167
  18. [13] validation_0-error:0.01719 validation_0-logloss:0.194562 validation_1-error:0.017674 validation_1-logloss:0.19555
  19. [14] validation_0-error:0.01719 validation_0-logloss:0.1807 validation_1-error:0.017674 validation_1-logloss:0.181463
  20. [15] validation_0-error:0.01719 validation_0-logloss:0.168585 validation_1-error:0.017674 validation_1-logloss:0.169138
  21. [16] validation_0-error:0.01719 validation_0-logloss:0.157988 validation_1-error:0.017674 validation_1-logloss:0.158345
  22. [17] validation_0-error:0.01719 validation_0-logloss:0.149407 validation_1-error:0.017674 validation_1-logloss:0.149731
  23. [18] validation_0-error:0.0259 validation_0-logloss:0.140835 validation_1-error:0.024651 validation_1-logloss:0.140979
  24. [19] validation_0-error:0.022003 validation_0-logloss:0.133937 validation_1-error:0.020465 validation_1-logloss:0.13405
  25. [20] validation_0-error:0.022003 validation_0-logloss:0.126967 validation_1-error:0.020465 validation_1-logloss:0.126914
  26. [21] validation_0-error:0.022003 validation_0-logloss:0.121386 validation_1-error:0.020465 validation_1-logloss:0.121303
  27. [22] validation_0-error:0.022003 validation_0-logloss:0.115692 validation_1-error:0.020465 validation_1-logloss:0.115456
  28. [23] validation_0-error:0.022003 validation_0-logloss:0.111147 validation_1-error:0.020465 validation_1-logloss:0.110881
  29. [24] validation_0-error:0.022003 validation_0-logloss:0.106477 validation_1-error:0.020465 validation_1-logloss:0.10607
  30. [25] validation_0-error:0.022003 validation_0-logloss:0.102434 validation_1-error:0.020465 validation_1-logloss:0.102319
  31. [26] validation_0-error:0.022003 validation_0-logloss:0.098434 validation_1-error:0.020465 validation_1-logloss:0.09819
  32. [27] validation_0-error:0.022003 validation_0-logloss:0.094875 validation_1-error:0.020465 validation_1-logloss:0.094824
  33. [28] validation_0-error:0.022003 validation_0-logloss:0.091579 validation_1-error:0.020465 validation_1-logloss:0.091784
  34. [29] validation_0-error:0.013294 validation_0-logloss:0.086202 validation_1-error:0.013488 validation_1-logloss:0.086807
  35. [30] validation_0-error:0.022003 validation_0-logloss:0.083247 validation_1-error:0.020465 validation_1-logloss:0.083741
  36. [31] validation_0-error:0.022003 validation_0-logloss:0.080496 validation_1-error:0.020465 validation_1-logloss:0.080924
  37. [32] validation_0-error:0.022003 validation_0-logloss:0.077298 validation_1-error:0.020465 validation_1-logloss:0.077394
  38. [33] validation_0-error:0.015815 validation_0-logloss:0.074507 validation_1-error:0.016279 validation_1-logloss:0.074765
  39. [34] validation_0-error:0.022003 validation_0-logloss:0.071848 validation_1-error:0.020465 validation_1-logloss:0.071811
  40. [35] validation_0-error:0.010543 validation_0-logloss:0.069488 validation_1-error:0.009302 validation_1-logloss:0.069385
  41. [36] validation_0-error:0.001834 validation_0-logloss:0.067147 validation_1-error:0.002326 validation_1-logloss:0.067341
  42. [37] validation_0-error:0.001834 validation_0-logloss:0.06504 validation_1-error:0.002326 validation_1-logloss:0.065406
  43. [38] validation_0-error:0.001834 validation_0-logloss:0.062898 validation_1-error:0.002326 validation_1-logloss:0.063381
  44. [39] validation_0-error:0.001834 validation_0-logloss:0.060837 validation_1-error:0.002326 validation_1-logloss:0.061088
  45. [40] validation_0-error:0.001834 validation_0-logloss:0.058894 validation_1-error:0.002326 validation_1-logloss:0.059039
  46. [41] validation_0-error:0.001834 validation_0-logloss:0.057112 validation_1-error:0.002326 validation_1-logloss:0.057326
  47. [42] validation_0-error:0.001834 validation_0-logloss:0.055391 validation_1-error:0.002326 validation_1-logloss:0.05543
  48. [43] validation_0-error:0.001834 validation_0-logloss:0.053745 validation_1-error:0.002326 validation_1-logloss:0.053871
  49. [44] validation_0-error:0.001834 validation_0-logloss:0.052198 validation_1-error:0.002326 validation_1-logloss:0.052235
  50. [45] validation_0-error:0.001834 validation_0-logloss:0.050776 validation_1-error:0.002326 validation_1-logloss:0.051033
  51. [46] validation_0-error:0.001834 validation_0-logloss:0.049351 validation_1-error:0.002326 validation_1-logloss:0.04973
  52. [47] validation_0-error:0.001834 validation_0-logloss:0.047848 validation_1-error:0.002326 validation_1-logloss:0.048287
  53. [48] validation_0-error:0.001834 validation_0-logloss:0.046406 validation_1-error:0.002326 validation_1-logloss:0.046702
  54. [49] validation_0-error:0.001834 validation_0-logloss:0.045141 validation_1-error:0.002326 validation_1-logloss:0.045492
  55. [50] validation_0-error:0.001834 validation_0-logloss:0.043917 validation_1-error:0.002326 validation_1-logloss:0.044133
  56. [51] validation_0-error:0.001834 validation_0-logloss:0.042729 validation_1-error:0.002326 validation_1-logloss:0.042999
  57. [52] validation_0-error:0.001834 validation_0-logloss:0.041608 validation_1-error:0.002326 validation_1-logloss:0.041807
  58. [53] validation_0-error:0.001834 validation_0-logloss:0.040493 validation_1-error:0.002326 validation_1-logloss:0.040855
  59. [54] validation_0-error:0.001834 validation_0-logloss:0.039457 validation_1-error:0.002326 validation_1-logloss:0.039871
  60. [55] validation_0-error:0.001834 validation_0-logloss:0.038452 validation_1-error:0.002326 validation_1-logloss:0.038755
  61. [56] validation_0-error:0.001834 validation_0-logloss:0.037478 validation_1-error:0.002326 validation_1-logloss:0.037717
  62. [57] validation_0-error:0.001834 validation_0-logloss:0.036439 validation_1-error:0.002326 validation_1-logloss:0.036777
  63. [58] validation_0-error:0.001834 validation_0-logloss:0.035552 validation_1-error:0.002326 validation_1-logloss:0.035936
  64. [59] validation_0-error:0.001834 validation_0-logloss:0.034694 validation_1-error:0.002326 validation_1-logloss:0.034984
  65. [60] validation_0-error:0.001834 validation_0-logloss:0.033826 validation_1-error:0.002326 validation_1-logloss:0.034132
  66. [61] validation_0-error:0.001834 validation_0-logloss:0.032959 validation_1-error:0.002326 validation_1-logloss:0.033348
  67. [62] validation_0-error:0.001834 validation_0-logloss:0.032192 validation_1-error:0.002326 validation_1-logloss:0.032526
  68. [63] validation_0-error:0.001834 validation_0-logloss:0.031476 validation_1-error:0.002326 validation_1-logloss:0.031754
  69. [64] validation_0-error:0.001834 validation_0-logloss:0.030756 validation_1-error:0.002326 validation_1-logloss:0.031081
  70. [65] validation_0-error:0.001834 validation_0-logloss:0.030038 validation_1-error:0.002326 validation_1-logloss:0.030377
  71. [66] validation_0-error:0.001834 validation_0-logloss:0.029332 validation_1-error:0.002326 validation_1-logloss:0.029594
  72. [67] validation_0-error:0.001834 validation_0-logloss:0.028703 validation_1-error:0.002326 validation_1-logloss:0.029079
  73. [68] validation_0-error:0.001834 validation_0-logloss:0.028064 validation_1-error:0.002326 validation_1-logloss:0.028391
  74. [69] validation_0-error:0.001834 validation_0-logloss:0.027404 validation_1-error:0.002326 validation_1-logloss:0.027725
  75. [70] validation_0-error:0.001834 validation_0-logloss:0.026824 validation_1-error:0.002326 validation_1-logloss:0.027187
  76. [71] validation_0-error:0.001834 validation_0-logloss:0.026268 validation_1-error:0.002326 validation_1-logloss:0.026565
  77. [72] validation_0-error:0.001834 validation_0-logloss:0.025679 validation_1-error:0.002326 validation_1-logloss:0.025982
  78. [73] validation_0-error:0.001834 validation_0-logloss:0.025153 validation_1-error:0.002326 validation_1-logloss:0.025413
  79. [74] validation_0-error:0.001834 validation_0-logloss:0.02461 validation_1-error:0.002326 validation_1-logloss:0.024927
  80. [75] validation_0-error:0.001834 validation_0-logloss:0.0241 validation_1-error:0.002326 validation_1-logloss:0.02446
  81. [76] validation_0-error:0.001834 validation_0-logloss:0.023615 validation_1-error:0.002326 validation_1-logloss:0.023921
  82. [77] validation_0-error:0.001834 validation_0-logloss:0.023118 validation_1-error:0.002326 validation_1-logloss:0.023423
  83. [78] validation_0-error:0.001834 validation_0-logloss:0.022671 validation_1-error:0.002326 validation_1-logloss:0.023015
  84. [79] validation_0-error:0.001834 validation_0-logloss:0.022244 validation_1-error:0.002326 validation_1-logloss:0.022538
  85. [80] validation_0-error:0.001834 validation_0-logloss:0.021793 validation_1-error:0.002326 validation_1-logloss:0.022087
  86. [81] validation_0-error:0.001834 validation_0-logloss:0.021396 validation_1-error:0.002326 validation_1-logloss:0.021654
  87. [82] validation_0-error:0.001834 validation_0-logloss:0.020948 validation_1-error:0.002326 validation_1-logloss:0.021198
  88. [83] validation_0-error:0.001834 validation_0-logloss:0.020559 validation_1-error:0.002326 validation_1-logloss:0.020806
  89. [84] validation_0-error:0.001834 validation_0-logloss:0.020144 validation_1-error:0.002326 validation_1-logloss:0.020388
  90. [85] validation_0-error:0.001834 validation_0-logloss:0.019775 validation_1-error:0.002326 validation_1-logloss:0.020057
  91. [86] validation_0-error:0.001834 validation_0-logloss:0.019029 validation_1-error:0.002326 validation_1-logloss:0.019235
  92. [87] validation_0-error:0.001834 validation_0-logloss:0.018672 validation_1-error:0.002326 validation_1-logloss:0.018823
  93. [88] validation_0-error:0.001834 validation_0-logloss:0.018313 validation_1-error:0.002326 validation_1-logloss:0.018507
  94. [89] validation_0-error:0.001834 validation_0-logloss:0.017989 validation_1-error:0.002326 validation_1-logloss:0.01815
  95. [90] validation_0-error:0.001834 validation_0-logloss:0.017376 validation_1-error:0.002326 validation_1-logloss:0.01748
  96. [91] validation_0-error:0.001834 validation_0-logloss:0.017087 validation_1-error:0.002326 validation_1-logloss:0.017189
  97. [92] validation_0-error:0.001834 validation_0-logloss:0.016778 validation_1-error:0.002326 validation_1-logloss:0.016877
  98. [93] validation_0-error:0.001834 validation_0-logloss:0.016458 validation_1-error:0.002326 validation_1-logloss:0.016527
  99. [94] validation_0-error:0.001834 validation_0-logloss:0.015932 validation_1-error:0.002326 validation_1-logloss:0.015956
  100. [95] validation_0-error:0.001834 validation_0-logloss:0.015645 validation_1-error:0.002326 validation_1-logloss:0.015665
  101. [96] validation_0-error:0.001834 validation_0-logloss:0.015379 validation_1-error:0.002326 validation_1-logloss:0.015397
  102. [97] validation_0-error:0.001834 validation_0-logloss:0.015116 validation_1-error:0.002326 validation_1-logloss:0.01513
  103. [98] validation_0-error:0.001834 validation_0-logloss:0.014883 validation_1-error:0.002326 validation_1-logloss:0.014893
  104. [99] validation_0-error:0.001834 validation_0-logloss:0.01464 validation_1-error:0.002326 validation_1-logloss:0.014624
  105. 【max_depth=2,lr=0.1】Test Accuracy: 99.81%
  106. {'validation_0': {'error': [0.045611, 0.041256, 0.045611, 0.041256, 0.041256, 0.041256, 0.023378, 0.041256, 0.041256, 0.023378, 0.00573, 0.01719, 0.01719, 0.01719, 0.01719, 0.01719, 0.01719, 0.01719, 0.0259, 0.022003, 0.022003, 0.022003, 0.022003, 0.022003, 0.022003, 0.022003, 0.022003, 0.022003, 0.022003, 0.013294, 0.022003, 0.022003, 0.022003, 0.015815, 0.022003, 0.010543, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834, 0.001834], 'logloss': [0.614637, 0.549907, 0.49543, 0.449089, 0.409231, 0.373748, 0.343051, 0.315369, 0.290912, 0.269356, 0.249593, 0.228658, 0.210442, 0.194562, 0.1807, 0.168585, 0.157988, 0.149407, 0.140835, 0.133937, 0.126967, 0.121386, 0.115692, 0.111147, 0.106477, 0.102434, 0.098434, 0.094875, 0.091579, 0.086202, 0.083247, 0.080496, 0.077298, 0.074507, 0.071848, 0.069488, 0.067147, 0.06504, 0.062898, 0.060837, 0.058894, 0.057112, 0.055391, 0.053745, 0.052198, 0.050776, 0.049351, 0.047848, 0.046406, 0.045141, 0.043917, 0.042729, 0.041608, 0.040493, 0.039457, 0.038452, 0.037478, 0.036439, 0.035552, 0.034694, 0.033826, 0.032959, 0.032192, 0.031476, 0.030756, 0.030038, 0.029332, 0.028703, 0.028064, 0.027404, 0.026824, 0.026268, 0.025679, 0.025153, 0.02461, 0.0241, 0.023615, 0.023118, 0.022671, 0.022244, 0.021793, 0.021396, 0.020948, 0.020559, 0.020144, 0.019775, 0.019029, 0.018672, 0.018313, 0.017989, 0.017376, 0.017087, 0.016778, 0.016458, 0.015932, 0.015645, 0.015379, 0.015116, 0.014883, 0.01464]}, 'validation_1': {'error': [0.048372, 0.042326, 0.048372, 0.042326, 0.042326, 0.042326, 0.023256, 0.042326, 0.042326, 0.023256, 0.006512, 0.017674, 0.017674, 0.017674, 0.017674, 0.017674, 0.017674, 0.017674, 0.024651, 0.020465, 0.020465, 0.020465, 0.020465, 0.020465, 0.020465, 0.020465, 0.020465, 0.020465, 0.020465, 0.013488, 0.020465, 0.020465, 0.020465, 0.016279, 0.020465, 0.009302, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002326, 0.002

网站声明:如果转载,请联系本站管理员。否则一切后果自行承担。

本文链接:https://www.xckfsq.com/news/show.html?id=3069
赞同 1
评论 0 条
云海麒麟L0
粉丝 0 发表 9 + 关注 私信
上周热门
银河麒麟添加网络打印机时,出现“client-error-not-possible”错误提示  1448
银河麒麟打印带有图像的文档时出错  1365
银河麒麟添加打印机时,出现“server-error-internal-error”  1151
统信桌面专业版【如何查询系统安装时间】  1073
统信操作系统各版本介绍  1070
统信桌面专业版【全盘安装UOS系统】介绍  1028
麒麟系统也能完整体验微信啦!  984
统信【启动盘制作工具】使用介绍  627
统信桌面专业版【一个U盘做多个系统启动盘】的方法  575
信刻全自动档案蓝光光盘检测一体机  484
本周热议
我的信创开放社区兼职赚钱历程 40
今天你签到了吗? 27
信创开放社区邀请他人注册的具体步骤如下 15
如何玩转信创开放社区—从小白进阶到专家 15
方德桌面操作系统 14
我有15积分有什么用? 13
用抖音玩法闯信创开放社区——用平台宣传企业产品服务 13
如何让你先人一步获得悬赏问题信息?(创作者必看) 12
2024中国信创产业发展大会暨中国信息科技创新与应用博览会 9
中央国家机关政府采购中心:应当将CPU、操作系统符合安全可靠测评要求纳入采购需求 8

添加我为好友,拉您入交流群!

请使用微信扫一扫!