您当前的位置: 首页 >  ar
  • 0浏览

    0关注

    2393博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

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

一个处女座的程序猿 发布时间:2019-05-25 10:01:04 ,浏览量:0

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

 

 

目录

输出结果

设计思路

核心代码

 

 

 

 

输出结果

 

 

 

设计思路

 

  核心代码
kfold = StratifiedKFold(n_splits=10, random_state=7)                                
#fit_params = {'eval_metric':"logloss"}
#results = cross_val_score(bst, X_train, y_train, cv=kfold, fit_params)
results = cross_val_score(bst, X_train, y_train, cv=kfold)                           
print(results)
print("7-CrVa Accuracy Mean(STD): %.2f%% (%.2f%%)" % (results.mean()*100, results.std()*100))  #输出


x = range(0,len(results))
y1 = results
y2 = [results.mean()]*10  
Xlabel = 'n_splits'
Ylabel = 'Accuracy'
title = 'mushroom datase: xgboost(sklearn+7CrVa) model'

plt.plot(x,y1,'g')                      #绘制曲线
plt.plot(x,y2,'r--')                    #平均值曲线
plt.xlabel(Xlabel)
plt.ylabel(Ylabel)
plt.title(title)
plt.show()

 

 

 

关注
打赏
1664196048
查看更多评论
立即登录/注册

微信扫码登录

0.0464s