New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XGBoost 2.0 doesn't support Optuna Pruning Callback #9608
Comments
You need the latest optuna: https://github.com/optuna/optuna/blob/a920a91e4e5a32ade707f3e9819fff0f96cc7946/optuna/integration/xgboost.py#L16 |
I'm using the latest Optuna (v3.3.0). It doesn't have TrainingCallback XGBoost required. See https://optuna.readthedocs.io/en/stable/reference/generated/optuna.integration.XGBoostPruningCallback.html And optuna latest code for XGBoost integration: https://github.com/optuna/optuna/blob/master/optuna/integration/xgboost.py |
So you can use |
@hcho3 Thank you, but, I'm sure the problem is on XGboost 2.0. Here's my reason: I just tried older version of xgboost optuna, same code, pruning worked in optuna. Then I upgraded optuna to latest version v3.3.0, till XGboost v1.7.6, pruning still worked in optuna. Problem started appear in xgboost 2.0. More details, here's my code to use optuna for XGboost. If you guys try this with latest xgboost and latest optuna, you should be able to replicate the error.
The error I got is "TypeError: callback must be an instance of I'm sure the problem is on latest xgboost. I want to use xgboost 2.0 is because it has Please took into this issue and fix this. Otherwise, who wants to use XGboost? |
This veers into unnecessary personal attack. Please do not do this again. Your post was fine without this sentence. If you keep posting uncivil comments like this, we will have to ban you. I understand you are frustrated. (Trust me, bugs frustrate us maintainers too.) Still, give us maintainers proper respect. |
Reopening, so that we can investigate |
@hanhanwu Thank you for providing the Python snippet. I was able to reproduce the error. Diagnosis Solution
This should fix the error. |
I see, thank you for the investigation. |
Sorry if the words made you guys feel disrespectful. In fact I felt being treated without respect here in the first place. I need to provide feedback here:
I don't care to be banned here. If asking a question can't get helpful answer and only felt more helpless, it's no better than being banned. I can go to Stackoverflow. Also, as a user, if the user experience is unpleasant, I won't use the tool, no matter how much efforts you guys spent on this product, especially when there're alternatives and future new tools. User interaction here is also part of user experience. |
Sure, apologies for the inconvenience. Sometimes I'm too used to these types of issues and assume that people will get the answer by looking into some of the code, hence the referenced link to optuna. There's definitely room for improvement. It's mostly open source project's issues, you see, it's not a product, and we are not customer service. I started contribution as a student in school. We expect the community to cooperate and help given that xgboost is a library and users are developers themselves, at least try to give some quick debugging to the issues at hand, it's not unusual for me to ask others do they want to open a PR. Feel free to reopen the issue if the answer is unsatisfying, we can provide further assistance at best effort. |
Apologies for closing the issue prematurely. Next time, we won't close issues until they are resolved. Also I am sorry that I rushed my 2nd response (#9608 (comment)). It was technically correct but not very helpful. I will try to do better next time.
Mostly because we are limited in our time. Like other open source projects, we try to provide support at the best effort basis. (Of course, this does not excuse closing this issue prematurely. I am just providing a context here.) |
Thank you guys! You guys are still very young, having lots of future potentials. I honestly think what you're doing here has more meaning than you think now. Don't plan to change you opinions, as a gift, want to share 2 stories:
These people all inspired me a lot in work. Sometimes, it's just this type of small things, Q&A made a difference. I wonder 5 years later, how are you guys going to think :) |
pip install git+https://github.com/optuna/optuna.git |
I still can't use it. I tried to install the development version of Optuna and the latest version of xgboost and it did not work. |
Could you please open a new issue with a reproducible example? |
In older version XGBoost, we can use Optuna prunning callback (see example code here). Like code below:
Now in XGBoost2.0
train()
function, Callback has to beTainingCallback
(https://xgboost.readthedocs.io/en/stable/python/python_api.html#callback-api), so we can't use Optuna pruning on XGboost any more..The text was updated successfully, but these errors were encountered: