Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Custom scikit-learn estimators from version 1.6#31424

Unanswered
lucasimi asked this question inQ&A
Discussion options

I have been developing a custom estimator class that follows scikit-learn's estimator API. Up to scikit-learn version1.5.2, this was straightforward because the estimator checks did not enforce strict type checks on tags, so I didn't need to import scikit-learn at all, my custom estimator would simply implement the required interface.

However, starting with scikit-learn version1.6, a new requirement was introduced: the estimator must implement a__sklearn_tags__() method that returns an instance of scikit-learn’s internalTags class. The built-in estimator checks now assert that the returned object is exactly an instance of thisTags class, which forces me to subclass or at least import this class from scikit-learn. This creates a problem for projects that want to be compatible with the scikit-learn estimator API but do not want to include scikit-learn itself as a direct dependency, either to reduce install size or avoid version conflicts.

Is there an easy or recommended way to satisfy this new scikit-learn 1.6+ tagging API requirement without having to add scikit-learn itself as a dependency? For example, can I somehow provide the Tags class or a compatible substitute so my custom estimator passes the checks, but without fully depending on the scikit-learn package?

You must be logged in to vote

Replies: 0 comments

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
1 participant
@lucasimi

[8]ページ先頭

©2009-2025 Movatter.jp