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

Skip to content

Gaussian Process Regression has false exception #13622

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
espg opened this issue Apr 11, 2019 · 3 comments
Closed

Gaussian Process Regression has false exception #13622

espg opened this issue Apr 11, 2019 · 3 comments

Comments

@espg
Copy link
Contributor

espg commented Apr 11, 2019

Description

Gaussian Process Regression throws a "non-positive definite matrix" error when it shouldn't.

Steps/Code to Reproduce

Without using sklearn, we get no error on the decomposition:

from scipy.linalg import cholesky
import numpy as np
K_ = np.load('./K_18_2.npy')
L_ = cholesky(K_, lower=True)

...returns no error, no exception, no warning.

Doing the same with gaussian process regression imported:

from sklearn.gaussian_process import gpr
from scipy.linalg import cholesky
import numpy as np
K_ = np.load('./K_18_2.npy')
L_ = cholesky(K_, lower=True)

Yields this error:

38 if info > 0:
39 raise LinAlgError("%d-th leading minor of the array is not positive "
---> 40 "definite" % info)
41 if info < 0:
42 raise ValueError('LAPACK reported an illegal value in {}-th argument'

LinAlgError: 113-th leading minor of the array is not positive definite

Get the dataset K_18_2.npy here:

https://keybase.pub/espg/K_18_2.npy

Expected Results

No error is thrown. Can use gpr on the data....

adding to the diagonal doesn't do anything-- and shouldn't be needed anyways for this dataset...

Actual Results

38 if info > 0:
39 raise LinAlgError("%d-th leading minor of the array is not positive "
---> 40 "definite" % info)
41 if info < 0:
42 raise ValueError('LAPACK reported an illegal value in {}-th argument'

LinAlgError: 113-th leading minor of the array is not positive definite

Versions

Impacts at least versions 0.20.x ; not present on 0.19.0 and earlier.

System:
python: 3.6.8 (default, Dec 24 2018, 03:01:30) [GCC 7.3.0]
executable: /nix/store/80qva2zal82njkg4zvb7xg94mnikqksd-python3-3.6.8/bin/python3.6m
machine: Linux-4.4.0-143-generic-x86_64-with-debian-stretch-sid

BLAS:
macros: SCIPY_MKL_H=None, HAVE_CBLAS=None
lib_dirs: /usr/local/intel/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64
cblas_libs: mkl_rt, pthread

Python deps:
pip: 18.1
setuptools: 40.2.0
sklearn: 0.20.3
numpy: 1.15.1
scipy: 1.1.0
Cython: 0.28.3
pandas: 0.23.4

@NicolasHug
Copy link
Member

It's pretty hard to reproduce with a matrix that's more than 1GB big. Would you have a smaller example?

In any case it seems that the sklearn is messing with the version of cholesky that is imported. Maybe it's because we're using absolute import in gpr.py?

In any case, why do you need to import gpr?

@TomDLT
Copy link
Member

TomDLT commented Apr 12, 2019

Is it possible that importing scikit-learn is changing which CBLAS is used by scipy ?
We recently removed our bundled CBLAS #11638, can you reproduce on master ?

@cmarmo cmarmo added module:gaussian_process Needs Decision - Close Requires decision for closing Needs Reproducible Code Issue requires reproducible code and removed Needs Reproducible Code Issue requires reproducible code Needs Decision - Close Requires decision for closing labels Feb 24, 2022
@cmarmo
Copy link
Contributor

cmarmo commented Feb 24, 2022

I have rerun the script with the current version and there is no Warning anymore.
I'm closing this one.

@cmarmo cmarmo closed this as completed Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants