Repository navigation
Save Scikit-Learn attributes into learner attributes. - #5245
Conversation
This PR modifies the behavior of saving Scikit-Learn model, pickle is no longer recommended. Instead an additional JSON file is produced for saving Scikit-Learn specific attributes. When using JSON output format in XGBoost, the additional file is subsumed into main model file. This will hurt IO performance as additional parsing/generating is required. We can mitigate it in the future by utilizing `XGBoosterGetModelRaw` with JSON, eliminating intermediate file IO.
|
Is this blocking? |
|
@hcho3 I hope so, but will value your opinion. It's gonna be painful for everyone who had used pickle before. So let's get started as soon as possible. |
|
@hcho3 @RAMitchell Please help with this PR as we will have to maintain it for a very long time. We promise the stability of output model, which includes this meta file. If you have suggestions or doubt, please share. |
|
I saved the additional attributes into It can be reverted to 9a364a7 if the previous approach is preferred. |
RAMitchell
left a comment
There was a problem hiding this comment.
I'm not very comfortable with these changes at the last minute. Saving an additional file is a bit of a strange behaviour, and I can't foresee how flexible this approach is going to be in future. I think it's acceptable that we break compatibility with 1.0 release.
|
Serialization has been a headache for Python objects in sklearn interface, and this is a welcome corrective. |
|
I was looking at the older commit, I like your new version much better than the file. The additional attribute is harmless right? I'm ok with this and defer to the two of you. |
|
I'd like to merge it soon, if there's no objection. |
This PR modifies the behavior of saving Scikit-Learn model, pickle is no longer
recommended.
Instead an additional JSON file is produced for savingScikit-Learn specific attributes. When using JSON output format in XGBoost,
the additional file is subsumed into main model file.
Instead the attributes are saved into
Learner::attributes_.