4
votes
clf = XGBClassifier(learning_rate =0.05,
                    n_estimators=300,
                    max_depth=10,
                    min_child_weight=1,
                    gamma=0.5,
                    reg_alpha=0,              
                    reg_lambda=2,
                    subsample=0.8,
                    colsample_bytree=0.8,
                    scale_pos_weight=1,
                    objective='multi:softmax',
                    num_class=14,
                    nthread=20,
                    seed=1000)
xgb_param = clf.get_xgb_params()
xgTrain = xgb.DMatrix(x_train_, label=y_train_)

print ('Start cross validation')
cvresult = xgb.cv(xgb_param, xgTrain, num_boost_round=500, nfold=5, metrics=['mlogloss'],
     early_stopping_rounds=5, stratified=True, seed=1000)


print('Best number of trees = {}'.format(cvresult.shape[0]))
clf.set_params(n_estimators=cvresult.shape[0])
print('Fit on the all_trainingsdata')
clf.fit(X_train,y_train,eval_metric=['mlogloss'])

WARNING: /workspace/src/learner.cc:480: Parameters: { scale_pos_weight } might not be used.

This may not be accurate due to some parameters are only used in language bindings but passed down to XGBoost core. Or some parameters are not used but slip through this verification. Please open an issue if you find above cases.

What does this mean? My notebook is running, it keeps arising repeatedly, should I ignore this or do what to stop it?

1

1 Answers

1
votes

scale_pos_weight is a parameter that is used in binary classification problems with unbalanced classes. If you have only a few positive examples and lots of negative examples, it can weight the positive examples more, which can improve accuracy.

You are doing a multiclass classification (as indicated by an objective of 'multi:softmax'), and so this parameter can't be applied.

Your notebook will run fine and you can trust your results. It's just a warning. You can eliminate it by removing the scale_pos_weight=1 parameter in your call.