Skip to content
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

restoring xgboost 0.82.1 version models (in R) with xgboost 1.1.1.1 or 1.2.01 still failing ? #6509

Closed
nirguk opened this issue Dec 15, 2020 · 13 comments · Fixed by #6517
Closed

Comments

@nirguk
Copy link

nirguk commented Dec 15, 2020

I am trying to adapt my workflow to later versions of xgboost, however earlier fitted models are causing me grief... I had hoped that the following comments indicated that a new compatability layer would solve this issue, however it seems not ?

#5794 has been addressed by #5940, and in the upcoming XGBoost version, you can read models from old RDS models again.
Originally posted by @hcho3 in #5815 (comment)

I provide a reprex here:
https://github.com/nirguk/xgboost_versions

for example sake, I fit an xgb model on Titanic data with binary:logitraw as objective.
I save this with xgb.save and then
I try to load this in 1.1.1.1 and also in 1.2.0.1 with xgb.load, but receive error:

Error in xgb.Booster.handle(modelfile = modelfile) : 
  [22:52:10] amalgamation/../src/objective/./regression_loss.h:89: Check failed: base_score > 0.0f && base_score < 1.0f: base_score must be in (0,1) for logistic loss, got: -0
@hcho3
Copy link
Collaborator

hcho3 commented Dec 15, 2020

@nirguk Your issue is unrelated to the RDS compatibility issue mentioned in #5794, as you are using xgb.load. I will take a look and see if it can be fixed in the upcoming patch release.

@nirguk
Copy link
Author

nirguk commented Dec 15, 2020

Thanks for the speedy response, does that imply I might have success saving and loading as RDS ? I will experiment with that in my reprex.

@hcho3
Copy link
Collaborator

hcho3 commented Dec 15, 2020

@nirguk Probably not. The issue appears to be in the core module of XGBoost, and using RDS would not fix the issue. Besides, we do not recommend the use of RDS for model archival: https://www.rdocumentation.org/packages/xgboost/versions/1.2.0.1/topics/a-compatibility-note-for-saveRDS-save

@hcho3
Copy link
Collaborator

hcho3 commented Dec 16, 2020

@nirguk Hello, I ran the script you provide and reproduced the same error. I am now investigating a possible fix.

@hcho3 hcho3 closed this as completed Dec 16, 2020
@hcho3 hcho3 reopened this Dec 16, 2020
@hcho3
Copy link
Collaborator

hcho3 commented Dec 16, 2020

Oops accidentally closed the issue. The issue is still being investigated.

@nir4most
Copy link

Thanks hcho3, this would be extremely useful !

@hcho3
Copy link
Collaborator

hcho3 commented Dec 16, 2020

Update: I verified that the use of objective='binary:logitraw' is causing the compatibility problem. If the objective is changed to binary:logistic, the 0.82 model can be read into 1.2.0.

@hcho3
Copy link
Collaborator

hcho3 commented Dec 16, 2020

It turns out the issue also exists in Python as well, so it's not specific to the R package.

@trivialfis
Copy link
Member

trivialfis commented Dec 16, 2020

@hcho3 We need to fill in an independent ProbToMargin implementation for logistic raw to avoid inheriting it from logistic.

@hcho3
Copy link
Collaborator

hcho3 commented Dec 16, 2020

I submitted #6517 which works around the issue. Let me see if I can write a separate ProbToMargin function for binary:logitraw.

@hcho3
Copy link
Collaborator

hcho3 commented Dec 17, 2020

@nirguk @nir4most Hello, the bug was fixed in #6517. The bug fix will be part of the upcoming patch release 1.3.1. Subscribe to #6518 to keep track of the progress for 1.3.1 release.

@nir4most
Copy link

Superb, thanks a million 😀

@hcho3
Copy link
Collaborator

hcho3 commented Dec 17, 2020

@nir4most If you'd like to try it out now, you can follow the instructions to install XGBoost from the latest source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants