我正在寻找使用XGBRegressor使用HalvingGridSearchCV的最佳超参数。以下是代码:
base_estimator = XGBRegressor(seed=1234,use_label_encoder=False,base_score=0.5,max_delta_step=0,
scale_pos_weight=1,nthread=12)
params = {'learning_rate': [0.2],
'max_depth': [500],
'min_child_weight': [50],
'gamma': [1.5],
'reg_alpha': [0.7],
'reg_lambda':[50],
'subsample':[1],
'colsample_bytree': [0.5],
'n_estimators':[1000]}
sh = HalvingGridSearchCV(base_estimator, param_grid=params, cv=5,
factor=2, max_resources=7926,resource='n_samples',
aggressive_elimination=True).fit(x_train, y_train,early_stopping_rounds=10,eval_metric='rmse', eval_set=[(x_test, y_test)], verbose=True)
print("Best: %f using %s" % (sh.best_score_, sh.best_params_))最佳选择: 0.058512使用{“colsample”:0.5,“伽马”:1.5,“学习速率”:0.2,“最大深度”:500,“最小_子质量”:50,‘n_估值器’:1000,'reg_alpha':0.7,'reg_lambda':50,‘子样本’:1}
我尝试了很多选择,但结果仍然很小,你能帮我,告诉我为什么吗?密码里有什么不好的吗?我不知道。
非常感谢
发布于 2022-07-05 09:45:07
这真的取决于数据。如果您尝试过许多超参数组合,但是性能仍然很差,则应该尝试使用更好的数据来训练模型。
https://stackoverflow.com/questions/69040247
复制相似问题