FIX: Compatibility with sklearn v1.8#1128
Merged
BenjaminBossan merged 1 commit intomasterfrom Dec 22, 2025
Merged
Conversation
There were two issues in skorch with sklearn v1.8 that are now fixed: __sklearn_is_fitted__ should return a bool. Instead, we were just raising or returning None. Not sure if this was already wrong when added (#1119) or if the API changed later. Moreover, sklearn was now raising an error when using the SkorchDoctor class because of missing __sklearn_tags__. This class now inherits from BaseEstimator, resolving this issue. For good measure, I also tested locally with sklearn 1.7 to ensure that these changes are backwards compatible. Unrelated changes: Remove an unnecessary import and trailing whitespace. Added __sklearn_is_fitted__ to SkorchDoctor too.
Collaborator
Author
|
PS: Interestingly, the CI installs scikit-learn v1.8 only for Python 3.11+ (because of this rule which I found surprising), so for the 3.10 runner, we still get v1.7: https://github.com/skorch-dev/skorch/actions/runs/20369283427/job/58531681371?pr=1128#step:4:34 This means that our CI tests both versions, which is nice I guess. |
thomasjpfan
approved these changes
Dec 20, 2025
Member
thomasjpfan
left a comment
There was a problem hiding this comment.
Small nit, otherwise LGTM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #1127.
There were two issues in skorch with sklearn v1.8 that are now fixed:
__sklearn_is_fitted__should return abool. Instead, we were just raising or returningNone. Not sure if this was already wrong when added (#1119) or if the API changed later.Moreover, sklearn was now raising an error when using the
SkorchDoctorclass because of missing__sklearn_tags__. This class now inherits fromBaseEstimator, resolving this issue.For good measure, I also tested locally with sklearn 1.7 to ensure that these changes are backwards compatible.
Unrelated changes:
Remove an unnecessary import and trailing whitespace. Added
__sklearn_is_fitted__toSkorchDoctortoo.