How to make XGBoost work with reg:squaredlogerror?

Viewed 420

I try to train XGBoost model with 'reg:squaredlogerror' as an objective, but it always outputs constant. A simple example:

import numpy as np
from xgboost import XGBRegressor

xgb1 = XGBRegressor(n_estimators = 60, objective='reg:squaredlogerror')
xgb1.fit(np.array([[1], [2], [3]]), np.array([1, 2, 3]))
xgb1.predict(np.array([[1], [2], [3]]))

output:

array([1.8770156, 1.8770156, 1.8770156], dtype=float32)

Same thing happens on larger sets of data. How do i create an XGBoost model that minimizes squared log error and is not a constant?

0 Answers
Related