當前位置:
首頁 >
ML之xgboost:利用xgboost算法(自带方式)训练mushroom蘑菇数据集(22+1,6513+1611)来预测蘑菇是否毒性(二分类预测)
發布時間:2025/3/21
65
豆豆
生活随笔
收集整理的這篇文章主要介紹了
ML之xgboost:利用xgboost算法(自带方式)训练mushroom蘑菇数据集(22+1,6513+1611)来预测蘑菇是否毒性(二分类预测)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
ML之xgboost:利用xgboost算法(自帶方式)訓練mushroom蘑菇數據集(22+1,6513+1611)來預測蘑菇是否毒性(二分類預測)
?
?
目錄
輸出結果
設計思路
核心代碼
?
?
?
輸出結果
?
1、xgboost(num_trees=0): Binary prediction based on ?Mushroom Dataset
?
2、xgboost(num_trees=1): Binary prediction based on ?Mushroom Dataset
?
3、xgboost(num_trees=1,max_depth=4): Binary prediction based on ?Mushroom Dataset
?
設計思路
數據集:Dataset之mushroom:mushroom蘑菇數據集的簡介、下載、使用方法之詳細攻略
?
?
?
核心代碼
?
preds = bst.predict(dtest) predictions = [round(value) for value in preds] test_accuracy = accuracy_score(y_test, predictions) print("Test Accuracy: %.2f%%" % (test_accuracy * 100.0))from matplotlib import pyplot import graphviz# num_trees=0 # xgb.plot_tree(bst, num_trees=0, rankdir= 'LR' ) #xgb.to_graphviz(bst,num_trees=0)# num_trees=1 xgb.plot_tree(bst,num_trees=1, rankdir= 'LR' ) #xgb.to_graphviz(bst,num_trees=1)?
?
?
總結
以上是生活随笔為你收集整理的ML之xgboost:利用xgboost算法(自带方式)训练mushroom蘑菇数据集(22+1,6513+1611)来预测蘑菇是否毒性(二分类预测)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 成功解决lib\subprocess.p
- 下一篇: 成功解决sklearn\preproce