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 · Fixed by #9177
Labels
Easy Well-defined and straightforward way to resolve
Milestone

Comments

@MechCoder
Copy link
Member

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.

@MechCoder MechCoder added the Easy Well-defined and straightforward way to resolve label Mar 21, 2016
qmaruf added a commit to qmaruf/scikit-learn that referenced this issue Mar 24, 2016
@qmaruf
Copy link

qmaruf commented Mar 24, 2016

@MechCoder Please take a look. This is fixed.

@jnothman
Copy link
Member

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

@MechCoder
Copy link
Member Author

I have registered my argument in the PR by @qmaruf

MechCoder pushed a commit to MechCoder/scikit-learn that referenced this issue Jun 20, 2017
GaelVaroquaux pushed 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 pushed 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 pushed 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 pushed 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 pushed 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 pushed 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 pushed 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
Labels
Easy Well-defined and straightforward way to resolve
Projects
None yet
4 participants