Ankit Seth
Ankit Seth

Reputation: 791

XGBoost error - Unknown objective function reg:squarederror

I am training a xgboost model for regression task and I passed the following parameters -

params = {'eta':0.4, 'max_depth':5, 'colsample_bytree':0.6, 'objective':'reg:squarederror'}
num_round = 10
xgb_model = xgboost.train(params, dtrain_x, num_round)

In the training phase I get the following error-

XGBoostError: b'[18:03:23] C:\Users\xgboost\src\objective\objective.cc:23: Unknown objective function reg:squarederror'

While in the docs, it is clearly a valid objective function. Can anyone tell me why am I getting this error?

INFO- I am using python 3.7.3 on windows and xgboost version is 0.82

Upvotes: 11

Views: 13029

Answers (1)

T.singh
T.singh

Reputation: 71

xgb_model = xgboost.train(**params, dtrain_x, num_round)

This would work for all versions. It is the way to pass **kwargs as a dictionary.

What does ** (double star/asterisk) and * (star/asterisk) do for parameters?

Upvotes: 5

Related Questions