Skip to content

FIX: Compatibility with sklearn v1.8#1128

Merged
BenjaminBossan merged 1 commit intomasterfrom
fix-compatibility-sklearn-v1.8
Dec 22, 2025
Merged

FIX: Compatibility with sklearn v1.8#1128
BenjaminBossan merged 1 commit intomasterfrom
fix-compatibility-sklearn-v1.8

Conversation

@BenjaminBossan
Copy link
Copy Markdown
Collaborator

Resolves #1127.

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.

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.
@BenjaminBossan
Copy link
Copy Markdown
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.

Copy link
Copy Markdown

@jobh jobh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit, otherwise LGTM

Comment thread skorch/net.py
@BenjaminBossan BenjaminBossan merged commit fe0a6bf into master Dec 22, 2025
16 checks passed
@BenjaminBossan BenjaminBossan deleted the fix-compatibility-sklearn-v1.8 branch December 22, 2025 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants