问题
I am using xgb api for python and when trying to do xgb.cv I get the following error,
param = {'max_depth': 6, 'eta': 0.1,'objective' :'reg:squarederror','subsample':0.8 ,'gamma':0,
'colsample_bytree':1,'nthread':cores,'base_score':y_train.mean(),'eval_metric':'rmse'}
num_round = 1
evallist = [(test, 'eval'), (train, 'train')]
xgb.cv(param, train, num_round, nfold=5,
metrics={'error'}, seed=0,
callbacks=[xgb.callback.print_evaluation(show_stdv=True)])
OSError Traceback (most recent call last)
<ipython-input-29-9d56c9a868ed> in <module>
5 xgb.cv(param, train, num_round, nfold=5,
6 metrics={'error'}, seed=0,
----> 7 callbacks=[xgb.callback.print_evaluation(show_stdv=True)])
~\Anaconda3\lib\site-packages\xgboost\training.py in cv(params, dtrain, num_boost_round, nfold, stratified, folds, metrics, obj, feval, maximize, early_stopping_rounds, fpreproc, as_pandas, verbose_eval, show_stdv, seed, callbacks, shuffle)
464 results = {}
465 cvfolds = mknfold(dtrain, nfold, params, seed, metrics, fpreproc,
--> 466 stratified, folds, shuffle)
467
468 # setup callbacks
~\Anaconda3\lib\site-packages\xgboost\training.py in mknfold(dall, nfold, param, seed, evals, fpreproc, stratified, folds, shuffle)
323 for k in range(nfold):
324 # perform the slicing using the indexes determined by the above methods
--> 325 dtrain = dall.slice(in_idset[k])
326 dtest = dall.slice(out_idset[k])
327 # run preprocessing on the data set if needed
~\Anaconda3\lib\site-packages\xgboost\core.py in slice(self, rindex, allow_groups)
955 c_bst_ulong(len(rindex)),
956 ctypes.byref(res.handle),
--> 957 ctypes.c_int(1 if allow_groups else 0)))
958 return res
959
OSError: [WinError -529697949] Windows Error 0xe06d7363
I already tried to install and uninstall XGB but I don't think that is the problem because I can train, the problem is when I try to do cross validation.
I am using:
Python : 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)]
xgb.version '1.1.0'
Update 20200831
What it worked for me was:
1. Uninstall xgboost
2. Upgrade pip
3. Reinstall xgboost using pip3 install xgboost
来源:https://stackoverflow.com/questions/63364048/windows-error-0xe06d7363-when-using-cross-validation-xgboost