【发布时间】:2021-12-11 03:14:59
【问题描述】:
我正在训练 XGBoost 模型并使用 randomSearchCV 进行超参数调整。我将参数分布指定为:
from xgboost import XGBRegressor
# Define a xgboost regression model
model = XGBRegressor()
params = {
"colsample_bytree": uniform(0.1, 0.2), # fraction of cols to sample
"gamma": uniform(0, 0.3), # min loss reduction required for next split
"learning_rate": uniform(0.02, 0.3), # default 0.1
"n_estimators": randint(100, 150), # default 100
"subsample": uniform(0.8, 0.75) # % of rows to use in training sample
}
r = RandomizedSearchCV(model, param_distributions=params, n_iter=100,
scoring="neg_mean_absolute_error", cv=3, n_jobs=1)
即使我为 subsample 指定的范围低于界限 [0,1],我也会收到以下错误。
raise XGBoostError(py_str(_LIB.XGBGetLastError()))
xgboost.core.XGBoostError: value 1.10671 for Parameter subsample exceed bound [0,1]
warnings.warn("Estimator fit failed. The score on this train-test"
任何想法为什么会发生这种情况?
【问题讨论】: