xgboost: Check failed: base_score > 0.0f && base_score < 1.0f base_score must be in (0,1) for logistic loss'

I keep getting this error on Windows 10 every time I try to run this code:

from xgboost import XGBClassifier 
xgb = XGBClassifier()

param_xgb = {
    'n_estimators': (10, 1000),
    'base_score': (0.01, 1, 'uniform')
}

xgb_grid = BayesSearchCV(
    estimator=xgb, search_spaces=param_xgb, scoring='recall', n_jobs=-1, cv=10)

xgb_grid.fit(X_train, y_train)

The full error outpt is this:

XGBoostError: b'[16:54:42] c:\\users\\administrator\\desktop\\xgboost\\src\\objective\\./regression_loss.h:62: Check failed: base_score > 0.0f && base_score < 1.0f base_score must be in (0,1) for logistic loss'

What am I doing wrong? It is the same error even with Sklearn’s GridSearchCV

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 27

Most upvoted comments

@PyDataBlog So actually I did get the error. The fix seems to be changing the line

'base_score': [0.01, 1],

to

'base_score': [0.01, 0.99],

since the requirement is that the base score to be strictly less than 1.0.

Can you post your data and script?

@PyDataBlog It is up now. Try running pip install xgboost==0.82

@PyDataBlog We just release the new 0.82 stable release. Python wheels will be available very soon.