Reputation: 31
When I use the XGBoostRegressor to predict the Stock Price, and I try to fit the model.
# XGBoostRegressor
parameters = {
'n_estimators': [100, 200, 300, 400],
'learning_rate': [0.001, 0.005, 0.01, 0.05],
'max_depth': [8, 10, 12, 15],
'gamma': [0.001, 0.005, 0.01, 0.02],
'random_state': [42]
}
eval_set = [(X_train, y_train), (X_valid, y_valid)]
model = xgb.XGBRegressor(eval_set = eval_set, objective = 'reg:squarederror', verbose = False)
clf = GridSearchCV(model, parameters)
clf.fit(X_train, y_train)
print(f'Best params: {clf.best_params_}')
print(f'Best validation score = {clf.best_score_}')
And then I got a WARNING.
Parameters: { "eval_set", "verbose" } might not be used.
This could be a false alarm, with some parameters getting used by language bindings but
then being mistakenly passed down to XGBoost core, or some parameter actually being used
but getting flagged wrongly here. Please open an issue if you find any such cases.
Repeat and Repeat again. I have already changed the parameters, but it did not work. And I did not find any methods to solve it? Did anyone meet this QUESTION? And How to solve it? Thanks.
Upvotes: 3
Views: 5916
Reputation: 5014
Pass the eval_set and verbose to fit() and not to XGBRegressor()
clf.fit(X_train, y_train, eval_set=eval_set, verbose=False)
Upvotes: 7