Python XGBoost参数';显示进度';出错

Python XGBoost参数';显示进度';出错,python,machine-learning,scikit-learn,xgboost,Python,Machine Learning,Scikit Learn,Xgboost,对于下面的函数,我并没有得到作为输出的估计数,相反,我得到了一个如下类型的误差 cv() got an unexpected keyword argument 'show_progress' 即使文档中包含该标志,我也得到了类型错误。我关注这个博客来进行参数调整。谁能告诉我哪里出了问题? 有没有其他方法可以得到估计数作为输出 def modelfit(alg, dtrain, predictors, useTrainCV=True, cv_folds=5, early_stopping_rou

对于下面的函数,我并没有得到作为输出的估计数,相反,我得到了一个如下类型的误差

cv() got an unexpected keyword argument 'show_progress'
即使文档中包含该标志,我也得到了类型错误。我关注这个博客来进行参数调整。谁能告诉我哪里出了问题? 有没有其他方法可以得到估计数作为输出

def modelfit(alg, dtrain, predictors, useTrainCV=True, cv_folds=5, early_stopping_rounds=50):
if useTrainCV:
    xgb_param = alg.get_xgb_params()
    xgtrain = xgb.DMatrix(dtrain[predictors].values, label=dtrain[target].values, silent=False)
    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, show_progress = True)
    alg.set_params(n_estimators=cvresult.shape[0])

#Fit the algorithm on the data
alg.fit(dtrain[predictors], dtrain[target],eval_metric='auc')

#Predict training set:
dtrain_predictions = alg.predict(dtrain[predictors])
dtrain_predprob = alg.predict_proba(dtrain[predictors])[:,1]

#Print model report:
print "\nModel Report"
print "Accuracy : %.4g" % metrics.accuracy_score(dtrain[target].values, dtrain_predictions)
print "AUC Score (Train): %f" % metrics.roc_auc_score(dtrain[target], dtrain_predprob)


feat_imp = pd.Series(alg.booster().get_fscore()).sort_values(ascending=False)
feat_imp.plot(kind='bar', title='Feature Importances')
plt.ylabel('Feature Importance Score')
xgboost的最新版本(0.6)为xgb.cv提供了以下选项:

xgboost.cv(params, dtrain, num_boost_round=10, nfold=3, 
stratified=False, folds=None, metrics=(), obj=None, feval=None, 
maximize=False, early_stopping_rounds=None, fpreproc=None, 
as_pandas=True, verbose_eval=None, show_stdv=True, seed=0, 
callbacks=None, shuffle=True)

show\u progress已被弃用,取而代之的是verbose\u eval。请参见

删除
显示进度=True
,它应该运行

您拥有哪个版本的xgboost?那个教程是哪个版本的?为什么你要把
**
放在
显示进度
的前面,它不在那个教程中。@VivekKumar我删除了*这个东西。我想强调一下那件事。您能告诉我如何检查版本吗?
pip freeze | grep xgboost
将显示您正在使用的版本。我能够重现您的相同错误,很可能是因为您使用的是1.0或更高版本。本教程相当旧,因此可能使用的是较旧的版本。如果上述操作不起作用,那么在终端中->
导入xgboost
然后
打印xgboost.\uuu版本\uuuu
通过
pip freeze | grep xgboost
我得到0.6