You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LinAlgError in test_spectral_lobpcg_mode with scipy 0.13.3 #2924
On Ubuntu 13.10 (Saucy), with numpy 1.8.0 and scipy 0.13.3, I get the following failure:
======================================================================
ERROR: sklearn.cluster.tests.test_spectral.test_spectral_lobpcg_mode
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/vagrant/venvs/2.7/local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/vagrant/code/scikit-learn/sklearn/cluster/tests/test_spectral.py", line 68, in test_spectral_lobpcg_mode
random_state=0, eigen_solver="lobpcg")
File "/home/vagrant/code/scikit-learn/sklearn/cluster/spectral.py", line 255, in spectral_clustering
eigen_tol=eigen_tol, drop_first=False)
File "/home/vagrant/code/scikit-learn/sklearn/manifold/spectral_embedding_.py", line 303, in spectral_embedding
largest=False, maxiter=2000)
File "/home/vagrant/venvs/2.7/local/lib/python2.7/site-packages/scipy/sparse/linalg/eigen/lobpcg/lobpcg.py", line 411, in lobpcg
activeBlockVectorBP, retInvR=True)
File "/home/vagrant/venvs/2.7/local/lib/python2.7/site-packages/scipy/sparse/linalg/eigen/lobpcg/lobpcg.py", line 148, in b_orthonormalize
gramVBV = sla.cholesky(gramVBV)
File "/home/vagrant/venvs/2.7/local/lib/python2.7/site-packages/scipy/linalg/decomp_cholesky.py", line 81, in cholesky
check_finite=check_finite)
File "/home/vagrant/venvs/2.7/local/lib/python2.7/site-packages/scipy/linalg/decomp_cholesky.py", line 30, in _cholesky
raise LinAlgError("%d-th leading minor not positive definite" % info)
LinAlgError: 2-th leading minor not positive definite
----------------------------------------------------------------------
The libatlas3-base and libatlas-dev packages are installed.
I will issue a PR to update the doc on this matter. We could also try to make the test more robust to work on the original lapack but I am not sure it's worth it.
The PR for the updated doc is here: #2926. The reference implementation of LAPACK /usr/lib/lapack/liblapack.so.3 is actually used when OpenBLAS is selected for providing BLAS. So it would indeed be worth making the test more robust.
Even with ATLAS it would be a good idea to fix the test. Turns out Debian prefers the reference LAPACK, giving it a higher priority:
$ update-alternatives --display liblapack.so
liblapack.so - auto mode
link currently points to /usr/lib/lapack/liblapack.so
/usr/lib/atlas-base/atlas/liblapack.so - priority 5
slave liblapack.a: /usr/lib/atlas-base/atlas/liblapack.a
/usr/lib/lapack/liblapack.so - priority 20
slave liblapack.a: /usr/lib/lapack/liblapack.a
Current 'best' version is '/usr/lib/lapack/liblapack.so'.
Not sure why, but I'm still getting this test failed with scikit-learn master. OS X 10.9.2, Python 2.7.5, numpy 1.8.1, scipy 0.13.3, Accelerate framework.
EDIT: Sorry, I was using a wrong scikit-learn version!
Activity
ogrisel commentedon Mar 3, 2014
@larsmans @GaelVaroquaux: I found the cause of the problem: by default
/usr/lib/liblapack.so.3is a symlink to the original lapack implementation:If you use
update-alternativesto symlink it to the Atlas implementation, the tests pass:I will issue a PR to update the doc on this matter. We could also try to make the test more robust to work on the original lapack but I am not sure it's worth it.
ogrisel commentedon Mar 3, 2014
The PR for the updated doc is here: #2926. The reference implementation of LAPACK
/usr/lib/lapack/liblapack.so.3is actually used when OpenBLAS is selected for providing BLAS. So it would indeed be worth making the test more robust.FIX scikit-learn#2924: make lobpcg test pass with reference and ATLAS…
ogrisel commentedon Mar 3, 2014
PR submitted in #2928: ping @GaelVaroquaux and @larsmans.
larsmans commentedon Mar 3, 2014
Also confirmed that it works fine with ATLAS. I had apparently reset my alternatives while trying to get SciPy 0.9 to build.
larsmans commentedon Mar 3, 2014
Even with ATLAS it would be a good idea to fix the test. Turns out Debian prefers the reference LAPACK, giving it a higher priority:
(same for
.so.3).ogrisel commentedon Mar 3, 2014
The #2928 makes the test pass both with reference lapack and with the atlas impl.
kmike commentedon May 13, 2014
Not sure why, but I'm still getting this test failed with scikit-learn master. OS X 10.9.2, Python 2.7.5, numpy 1.8.1, scipy 0.13.3, Accelerate framework.EDIT: Sorry, I was using a wrong scikit-learn version!