-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Implications of FrozenEstimator on our API #29893
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
Comments
Was just talking with @glemaitre about this and we also very much agree with these points (or at least I thought Guillaume agrees 😅 ). I'd like to have the This also deserves a @scikit-learn/core-devs ping. |
In addition of So in general, I think that using the
To me there is one downside:
So given the pros/cons that I could come with, I'm pretty much in favor of introducing |
Would it be weird to add a Perhaps it adds too much complexity and the user is confused because then there are multiple ways of "getting a frozen estimator"? |
I wouldn't mind a |
@ogrisel you might like the |
No strong opinion on whether we need it or not, but if we introduce it, I would vote in favor of a top level |
You still need to import it (unless you already imported the top level EDIT: this comment is wrong. |
Oh, I misread the proposals. I did not realize the proposal above was about introducing a method instead of a function... |
For third party estimators who inherit from |
I feel that a function rather than a method is more natural with the current state of our code base. It would stand nicely next to I would find strange that cloning and freeze are not aligned in this regard (i.e. function vs method). |
I would be more in favor of adding a I'd be somewhat against a |
My intuition is also that a standalone function would be nicer than adding a method. |
If we do a function, in effect, we're changing (1) from sklearn.frozen import FrozenEstimator
MetaEstimator(estimator=FrozenEstimator(subestimator)) or import sklearn
MetaEstimator(estimator=sklearn.frozen.FrozenEstimator(subestimator)) to (2) from sklearn import freeze
MetaEstimator(estimator=freeze(subestimator)) or import sklearn
MetaEstimator(estimator=sklearn.freeze(subestimator)) while having a method, would mean (3) MetaEstimator(estimator=subestimator.freeze()) To me, (1) and (2) are not different enough to warrant the function, while (3) is a nicer enough experience that it's worth doing. |
Since this alternative avoids an import and looking at #30171 when it comes to usability, then I would agree that methods might be nicer to use. |
With #29705, we have a simple way to freeze estimators, which means there is no need for
cv="prefit"
. This also opens the door for #8350 to makePipeline
andFeatureUnion
follow our conventions. This issue is to discuss the API implications of introducingFrozenEstimator
. Here are the two I had in mind:cv="prefit"
For the cv case, users pass a frozen estimator directly into cv:
Making this change will simplify our codebase with
cv="prefit"
compose.Pipeline
We introduce a new
compose.Pipeline
which follows our conventions withclone
. (The currentpipeline.Pipeline
does not clone.)In both cases, I like prefer the semantics of
FrozenEstimator
.The text was updated successfully, but these errors were encountered: