Skip to content

Add a return_std_of_f kwarg to GPC's predict and predict_proba, just like the one GPR has #22226

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
miguelgondu opened this issue Jan 15, 2022 · 2 comments · Fixed by #22227
Closed

Comments

@miguelgondu
Copy link
Contributor

Describe the workflow you want to enable

Gaussian Process Regression in sklearn comes with the affordance to return standard deviations of the predictions in the gpr.predict method. The Gaussian Process Classifier doesn't. The main reason why (I assume) is that we don't have direct access to the standard deviation of our class estimates. We do, however, have access to the standard deviation of the latent variable f, and giving users access to it may allow them to have access to uncertainty estimates of the predicted classes by e.g. ancestral sampling or other Monte Carlo methods.

In this issue, I propose we add a keyword argument return_std_of_f=False to the methods predict and predict_proba of sklearn.gaussian_processes.GaussianProcessClassifier. This would allow us to return the standard deviation of the latent function f, a value that is already being computed in the predict_proba method.

Describe your proposed solution

The solution is actually pretty simple, since the computations are already being done in the method gpc.predict_proba. Namely, This line corresponds to computing the variance of the latent function $f$'s prediction on the test points. This addition would only need to be

  1. The same computation under an if for the gpc.predict method.
  2. An if statement with different returns according to the return_std_of_f flag for the gpc.predict_proba method.

Describe alternatives you've considered, if relevant

No response

Additional context

No response

@miguelgondu miguelgondu added Needs Triage Issue requires triage New Feature labels Jan 15, 2022
@miguelgondu
Copy link
Contributor Author

miguelgondu commented Jan 15, 2022

While implementing it I'm running into an issue. It is easy to do for the _BinaryGaussianProcessClassifierLaplace estimator, but it is somewhat not trivial for the multiclass setting, because the OneVsRestClassifier and OneVsOneClassifier have been abstracted away, and are very generic for estimators.

This flag is however very particular to GPCs. I implemented it only for the binary setting using Laplace's approximation.

@jungtaekkim
Copy link

Hi,

Can I ask why this issue and the associated PR are not wrapped up?

I think this issue is important for maintaining consistency with GaussianProcessRegressor.

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

Successfully merging a pull request may close this issue.

4 participants