【发布时间】:2021-10-09 19:10:21
【问题描述】:
如何实现param_grid 并为 xgb 获得最佳超参数?
regressor = xgb.XGBRegressor()
regressor.fit(X_train,y_train)
param_grid = {
'max_depth' :[3,4,5],
'learning_rate':[0.1, 0.01, 0.5],
'gamma':[0,0.25,1],
'reg_lambda':[0, 1.0, 10.0],
'scale_pos_weight':[1,3,5]
}
optimal_params = GridSearchCV(estimator = xgb.XGBRegressor(subsample=0.9, colsample_bytree=0.5), param_grid = param_grid, verbose = 0,)
optimal_params.fit(X_train, y_train, verbose = False)
编译并反复显示此警告需要很长时间:
[16:45:55] WARNING: /workspace/src/objective/regression_obj.cu:152:
reg:linear is now deprecated in favor of reg:squarederror.
【问题讨论】:
标签: python machine-learning xgboost xgbregressor