-
-
Notifications
You must be signed in to change notification settings - Fork 26k
ENH Adds InconsistentVersionWarning when unpickling version doesn't match #25297
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise I like the PR.
I am split here. The change is simple. However, the solution is a bit in between parsing the warning message and just having a nice attribute. Since the other solution involves adding a |
I like it. Same question as Adrin about the parsing vs separate arguments. A curiosity: when I load an estimator pickled in an older version of sklearn in ipython I see the same warning twice. Does someone know if this is a "weird thing" related to ipython or normal behaviour or something totally different? A separate thing (so we can punt it to a new PR if we want to) that I find confusing about this is that a estimator pickled with v1 and then unpickled with this PR (or any future version) will return |
@betatim the key is never present (and I think it's a good thing) since |
Shall we document the way to programmatically recover the pickle version in the persistence documentation? |
Sounds like a good idea. If there is a documented way to get the version used to fit an estimator that reduces the number of people calling I hadn't realised that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then, LGTM.
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
…atch (scikit-learn#25297) Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Reference Issues/PRs
Closes #25273
Alternative to #25280
What does this implement/fix? Explain your changes.
This PR adds more information to the warning, so a user can record the warning and get information about the version used to pickle the estimator:
One can also turn the warning into an error and get the
original_sklearn_version
from there:Any other comments?
This PR does not add any more state of the estimator itself.