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
Inconsistent behavior of linalg.slogdet() #18978
Comments
npy.zip |
The |
@charris not sure I got your point. If determinant of one of the matrices is -49 and these matrices are similar, then they are hardly singular.
|
Which BLAS are you using? On MKL I see
|
The smallest eigenvalue is numerically not different from 0. Small differences can make a non-trivial difference to this noise eigenvalue.
Both |
@bashtage numpy.show_config() is not informative now. I only can tell you that one of the systems is Windows 10 with processor Intel(R) Core(TM) i7-9850H, no GPU, and I used default 64-bit installer from python.org. But I can not guarantee that it is MKL. Results of np.linalg.eigvals() in my system: [4.87687978e+00 2.18850804e+00 1.84140287e+00 1.55259050e+00 [4.87687978e+00 2.18850804e+00 1.84140287e+00 1.55259050e+00 |
@bashtage OK, then there is an amendment to the issue: |
@bashtage @charris Interesting update: Next, I tried to run |
You are using OpenBLAS. That bug only afffects Windows so isn't your problem in AWS. I think this is just an edge case. If you think your covariance may not be positive definite then you should check and use an appropriate correction. I think this is just squarely in the area of numerical precision limits which is why you are seeing these mixed results when you try different platforms or even different algorithms. For example:
and since
but
|
There are two almost equal arrays generated by the same pipeline in different systems. (All differences between respective items are about 1e-16 and apparently caused by differences in hardware.)
I would expect result of linalg.slogdet() for them very similar, respectively.
However the result for one is about -49.04, and the result for another is -inf.
The npy files are attached.
Reproducing code example:
Error message:
The code below prints the following:
-inf
-49.041742650541245
Expected result is about -49.04 in both cases.
(FYI: this inconsistency leads to 20-30% difference in final results in our project on different systems.)
NumPy/Python version information:
1.20.2 3.9.4 (default, May 4 2021, 16:03:03)
[GCC 9.3.0]
The same behaviour is with Python 3.7.10 on both Windows and Linux.
The text was updated successfully, but these errors were encountered: