Skip to content

API Removes the use of fit_ and partial_fit_ in Birch #19297

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

Merged

Conversation

thomasjpfan
Copy link
Member

This PR removes the use of fit_ and partial_fit_ in Birch and update the implementation to not require it.

CC @jeremiedbb @adrinjalali

)
@property
def fit_(self):
return self.__fit
Copy link
Member Author

Choose a reason for hiding this comment

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

Because _fit is already taken.

Copy link
Member

Choose a reason for hiding this comment

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

A double underscore in Python does "name mangling" which is not necessarily a thing Python developers are familiar with:

https://en.wikipedia.org/wiki/Name_mangling#Python

I don't think this is necessarily a problem for this code but maybe we should avoid them for the sake of not surprising people?

We could use _deprecad_fit_flag instead for instance.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated PR with a non-named mangled name.

Copy link
Member

@jeremiedbb jeremiedbb left a comment

Choose a reason for hiding this comment

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

LGTM.

I guess we still need to document them in the mean time (being done in #18796).

Comment on lines 479 to 480
self.__fit, self.__partial_fit = True, False
return self._fit(X, partial=False)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a comment "TODO remove in 1.2" so we don't forget (there's another occurence below).

Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

+1 for the general idea. We just need to agree on the point on name mangling raised here: #19297 (comment) and fix it if we judge that it's better to avoid name mangling in our code base.

@adrinjalali adrinjalali merged commit aa1e69a into scikit-learn:main Jan 30, 2021
@glemaitre glemaitre mentioned this pull request Apr 22, 2021
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants