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'])
警告:/workspace/src/learner.cc:480: 参数:可能不使用{scale_pos_weight}。
由于某些参数仅用于语言绑定,但由于某些参数而可能不正确 传递给XGBoost核心。或不使用某些参数,而是通过 验证。如果发现上述情况,请打开一个问题。
这是什么意思? 我的笔记本计算机正在运行,并且不断重复出现,我应该忽略它还是采取措施停止它?
答案 0 :(得分:1)
scale_pos_weight 是一个用于不平衡类的二元分类问题的参数。如果正例少,反例多,可以对正例加权,提高准确率。
您正在进行多类分类(如“multi:softmax”的目标所示),因此无法应用此参数。
您的笔记本将运行良好,您可以相信自己的结果。这只是一个警告。您可以通过删除调用中的 scale_pos_weight=1 参数来消除它。