Thanks to visit codestin.com
Credit goes to github.com

Skip to content

SLEP006 - equal requests? {fit, partial_fit}, {predict, predict_proba, predict_log_proba, decision_function} #22988

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

Closed
adrinjalali opened this issue Mar 29, 2022 · 8 comments

Comments

@adrinjalali
Copy link
Member

adrinjalali commented Mar 29, 2022

Raised in #22986 (comment) the question is whether these two sets of methods should always accept the same metadata:

  • fit and partial_fit
  • predict, predict_proba, predict_log_proba, and decision_function.

I think they should, and I suggest we add a common test for them accepting the same metadata, and only have set_fit_request and set_predict_request exposed to users.

cc @jnothman

@github-actions github-actions bot added the Needs Triage Issue requires triage label Mar 29, 2022
@thomasjpfan thomasjpfan added Needs Decision - API and removed Needs Triage Issue requires triage labels Mar 29, 2022
@adrinjalali adrinjalali changed the title SLEP006 - requests: fit =?= partial_fit, predict =?= predict_proba =?= predict_log_proba =?= decision_function SLEP006 - equal requests? {fit, partial_fit}, {predict, predict_proba, predict_log_proba, decision_function} Mar 30, 2022
@jnothman
Copy link
Member

jnothman commented Apr 3, 2022

I think it's worth clarifying that we're not talking about return_*, which isn't really applicable to the routing mechanism, because it's not about inputs..?

I'm okay with this at first thought... what are the risks if we have to then split them up later???

@thomasjpfan
Copy link
Member

I think having to distinguish between return_* kwarg and "input metadata" will complicated the API for third party estimator developers.

Also for classifiers, partial_fit accepts classes that we do not usually accept in fit. We would need to introduce classes to fit if we want fit* to accept the same metadata.

@jnothman
Copy link
Member

jnothman commented Apr 3, 2022

Hmmm… I suppose there are a couple of needs for the return parameters: either it is needed directly by a wrapping estimator, or it’s needed for scoring or similar and requested by the user. I had been thinking of the former case, but I suppose you are right about the latter

@adrinjalali
Copy link
Member Author

I think having to distinguish between return_* kwarg and "input metadata" will complicated the API for third party estimator developers.

If developers would want to remove an arg from the routing mechanism, the API as is allows us to do so:

__metadata_request__fit = {'return_blah': RequestType.UNUSED}

The above code would remove return_blah from the whole request/routing mechanism.

So to summarize: fit and fit_transform have different input args and therefore we would have both methods: set_fit_request and set_partial_fit_request.

Do we also want to keep the other predict* group separate? I think it'd be foreseeable that decision_function accepts different input args than predict* at least.

@jnothman
Copy link
Member

So to summarize: fit and fit_transform have different input args and therefore we would have both methods: set_fit_request and set_partial_fit_request.

There's a typo here, I think?

@jnothman
Copy link
Member

Do we also want to keep the other predict* group separate? I think it'd be foreseeable that decision_function accepts different input args than predict* at least.

I'm really unsure about this one. I think these methods are likely to have different return_ flags, but otherwise should receive the same params??

@adrinjalali
Copy link
Member Author

So the conclusion seems to be that we're gonna keep them separate at least for now. I'll open a PR to reflect this.

@adrinjalali
Copy link
Member Author

Fixed in #23342

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants