Closed georgi72 closed 1 month ago
How did you install XGBoost? I could not reproduce the error when I installed XGBoost 2.0.3 using pip install xgboost
.
I used "conda install -c conda-forge py-xgboost".
Now I upgraded to v.2.0.3 using "pip3 install xgboost==2.0.3" and get the same error.
Can you install XGBoost again? It appears that your XGBoost installation is somehow corrupted.
I uninstalled and reinstalled xgboost using "pip install xgboost". The version is 2.0.3. I get the same result. Not sure what is going on.
Could you please print out the XGB version before the training code?
import xgboost
print(xgboost.__version__)
...
booster = xgb.train(
{
# Use the quantile objective function.
"objective": "reg:quantileerror",
"tree_method": "hist",
"quantile_alpha": alpha,
# Let's try not to overfit.
"learning_rate": 0.04,
"max_depth": 5,
},
Xy,
num_boost_round=32,
early_stopping_rounds=2,
# The evaluation result is a weighted average across multiple quantiles.
evals=[(Xy, "Train"), (Xy_test, "Test")],
evals_result=evals_result,
)
import xgboost print(xgboost.version) 2.0.3
Could you please share the complete error message?
XGBoostError: [06:08:55] C:\buildkite-agent\builds\buildkite-windows-cpu-autoscaling-group-i-08de971ced8a8cdc6-1\xgboost\xgboost-ci-windows\src\objective\objective.cc:26: Unknown objective function: reg:quantileerror
Objective candidate: survival:aft
Objective candidate: binary:hinge
Objective candidate: multi:softmax
Objective candidate: multi:softprob
Objective candidate: rank:pairwise
Objective candidate: rank:ndcg
Objective candidate: rank:map
Objective candidate: survival:cox
Objective candidate: reg:gamma
Objective candidate: reg:tweedie
Objective candidate: reg:squarederror
Objective candidate: reg:squaredlogerror
Objective candidate: reg:logistic
Objective candidate: binary:logistic
Objective candidate: binary:logitraw
Objective candidate: reg:linear
Objective candidate: reg:absoluteerror
Objective candidate: reg:pseudohubererror
Objective candidate: count:poisson
@hcho3 Did you try it on Windows? I don't understand why the objective isn't registered.
Yes, I am working in Windows. I don't understand either.
I just tried running demo/guide-python/quantile_regression.py
on Windows and could not reproduce the error either. I installed XGBoost 2.0.3 using pip install xgboost
.
I don't know if they are related, but using the R package (v1.7.7.1 binary from CRAN) when I attempt to use reg:quantileerror
I also get an error that it is an unrecognized objective:
library(xgboost)
y <- mtcars$mpg
X <- as.matrix(mtcars[,-1])
res <- xgboost(
data = X,
label = y,
nrounds = 100,
params = list(objective = "reg:quantileerror",alpha = c(0.1,0.5,0.9))
)
yields this error:
Error in xgb.iter.update(bst$handle, dtrain, iteration - 1, obj) :
[15:19:47] src/objective/objective.cc:26: Unknown objective function: `reg:quantileerror`
Objective candidate: reg:squarederror
Objective candidate: reg:squaredlogerror
Objective candidate: reg:logistic
Objective candidate: binary:logistic
Objective candidate: binary:logitraw
Objective candidate: reg:linear
Objective candidate: reg:pseudohubererror
Objective candidate: count:poisson
Objective candidate: survival:cox
Objective candidate: reg:gamma
Objective candidate: reg:tweedie
Objective candidate: reg:absoluteerror
Objective candidate: multi:softmax
Objective candidate: multi:softprob
Objective candidate: rank:pairwise
Objective candidate: rank:ndcg
Objective candidate: rank:map
Objective candidate: binary:hinge
Objective candidate: survival:aft
Stack trace:
[bt] (0) 1 xgboost.so 0x0000000129009e3c dmlc::LogMessageFatal::~LogMessageFatal() + 124
[bt] (1) 2 xgboost.so 0x0000000129030970 xgboost::ObjFunction::Create(st
The stack trace is cut off as I've shown it, there isn't anything more printed to the console.
Specifying another optional objective function, e.g. reg:absoluteerror
runs fine with no errors.
R is on 1.7.x, which doesn't include quantile function yet. We are working on the R interface, see https://github.com/dmlc/xgboost/issues/9810 .
Same error here for version 2.0.3. The interesting thing is that: if I run pip install xgboost==2.0.3
from a notebook, I get this error. But if I run from the system and install the library, this error disappears.
Closing due to unable to reproduce. Feel free to reopen if you can share the environment for debugging.
import xgboost as xgb
xgb.version Out[203]: '2.0.2'
booster = xgb.train( {
Use the quantile objective function.
)
XGBoostError: [11:04:05] C:\buildkite-agent\builds\buildkite-windows-cpu-autoscaling-group-i-08de971ced8a8cdc6-1\xgboost\xgboost-ci-windows\src\objective\objective.cc:26: Unknown objective function:
reg:quantileerror
According to the documentation, quantile error is implemented in v.2.0.2. What am I missing? Thank you.