600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > ML之xgboost:利用xgboost算法(自带方式)训练mushroom蘑菇数据集(22+1 6513+1611)来

ML之xgboost:利用xgboost算法(自带方式)训练mushroom蘑菇数据集(22+1 6513+1611)来

时间:2019-10-01 17:20:35

相关推荐

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 pyplotimport graphviz# num_trees=0# xgb.plot_tree(bst, num_trees=0, rankdir= 'LR' ) #xgb.to_graphviz(bst,num_trees=0)# num_trees=1xgb.plot_tree(bst,num_trees=1, rankdir= 'LR' )#xgb.to_graphviz(bst,num_trees=1)

ML之xgboost:利用xgboost算法(自带方式)训练mushroom蘑菇数据集(22+1 6513+1611)来预测蘑菇是否毒性(二分类预测)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。