Skip to content
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

GaussianProcessRegressor raises error for prediction without prior fitting when `return_std` is set to True for default parameters #6573

Closed
MechCoder opened this issue Mar 21, 2016 · 3 comments
Labels
Milestone

Comments

@MechCoder
Copy link
Member

@MechCoder MechCoder commented Mar 21, 2016

gpr = GaussianProcessRegressor()
gpr.predict(X, return_cov=True)
TypeError: 'NoneType' object is not callable
gpr.predict(X, return_std=True)
AttributeError: 'NoneType' object has no attribute 'diag'

This is because self.kernel is None during predict time. We should set self.kernel_ to be the default RBFKernel (as done during fit time) and return the correlation matrix of the RBFKernel.

@qmaruf
Copy link

@qmaruf qmaruf commented Mar 24, 2016

@MechCoder Please take a look. This is fixed.

@jnothman
Copy link
Member

@jnothman jnothman commented Jun 14, 2017

I think we should just be calling check_is_fitted in predict, shouldn't we?

@MechCoder
Copy link
Member Author

@MechCoder MechCoder commented Jun 14, 2017

I have registered my argument in the PR by @qmaruf

MechCoder added a commit to MechCoder/scikit-learn that referenced this issue Jun 20, 2017
GaelVaroquaux added a commit that referenced this issue Jun 25, 2017
…t. (#9177)

* If self.kernel_ is None then self.kernel_ is set to RBFKernel in predict() as fit(). Fixes #6573

* xxx_ attributes can not be altered outside fit. Removing self.kernel_ from predict() and using previously implemented self.kernel attribute.

* Cleanup and add non-regression-test
dmohns added a commit to dmohns/scikit-learn that referenced this issue Aug 7, 2017
…t. (scikit-learn#9177)

* If self.kernel_ is None then self.kernel_ is set to RBFKernel in predict() as fit(). Fixes scikit-learn#6573

* xxx_ attributes can not be altered outside fit. Removing self.kernel_ from predict() and using previously implemented self.kernel attribute.

* Cleanup and add non-regression-test
dmohns added a commit to dmohns/scikit-learn that referenced this issue Aug 7, 2017
…t. (scikit-learn#9177)

* If self.kernel_ is None then self.kernel_ is set to RBFKernel in predict() as fit(). Fixes scikit-learn#6573

* xxx_ attributes can not be altered outside fit. Removing self.kernel_ from predict() and using previously implemented self.kernel attribute.

* Cleanup and add non-regression-test
NelleV added a commit to NelleV/scikit-learn that referenced this issue Aug 11, 2017
…t. (scikit-learn#9177)

* If self.kernel_ is None then self.kernel_ is set to RBFKernel in predict() as fit(). Fixes scikit-learn#6573

* xxx_ attributes can not be altered outside fit. Removing self.kernel_ from predict() and using previously implemented self.kernel attribute.

* Cleanup and add non-regression-test
paulha added a commit to paulha/scikit-learn that referenced this issue Aug 19, 2017
…t. (scikit-learn#9177)

* If self.kernel_ is None then self.kernel_ is set to RBFKernel in predict() as fit(). Fixes scikit-learn#6573

* xxx_ attributes can not be altered outside fit. Removing self.kernel_ from predict() and using previously implemented self.kernel attribute.

* Cleanup and add non-regression-test
AishwaryaRK added a commit to AishwaryaRK/scikit-learn that referenced this issue Aug 29, 2017
…t. (scikit-learn#9177)

* If self.kernel_ is None then self.kernel_ is set to RBFKernel in predict() as fit(). Fixes scikit-learn#6573

* xxx_ attributes can not be altered outside fit. Removing self.kernel_ from predict() and using previously implemented self.kernel attribute.

* Cleanup and add non-regression-test
maskani-moh added a commit to maskani-moh/scikit-learn that referenced this issue Nov 15, 2017
…t. (scikit-learn#9177)

* If self.kernel_ is None then self.kernel_ is set to RBFKernel in predict() as fit(). Fixes scikit-learn#6573

* xxx_ attributes can not be altered outside fit. Removing self.kernel_ from predict() and using previously implemented self.kernel attribute.

* Cleanup and add non-regression-test
jwjohnson314 pushed a commit to jwjohnson314/scikit-learn that referenced this issue Dec 18, 2017
…t. (scikit-learn#9177)

* If self.kernel_ is None then self.kernel_ is set to RBFKernel in predict() as fit(). Fixes scikit-learn#6573

* xxx_ attributes can not be altered outside fit. Removing self.kernel_ from predict() and using previously implemented self.kernel attribute.

* Cleanup and add non-regression-test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.