temp.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:trend_ml_toolkit_xgboost 作者: raymon-tian 项目源码 文件源码
def tune_n_estimators(alg,xgtrain,useTrainCV=True, cv_folds=5, early_stopping_rounds=50):
    if useTrainCV:
        xgb_param = alg.get_xgb_params()
        cvresult = xgb.cv(xgb_param, xgtrain, num_boost_round=alg.get_params()['n_estimators'], nfold=cv_folds,
                          metrics='auc', early_stopping_rounds=early_stopping_rounds,verbose_eval=True, show_stdv=True)
        # alg.set_params(n_estimators=cvresult.shape[0])
    return cvresult.shape[0]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号