[Numpy-discussion] Behavior of np.random.multivariate_normal with bad covariance matrices

Blake Griffith blake.a.griffith at gmail.com
Sun Mar 29 19:39:00 EDT 2015


I have an open PR which lets users control the checks on the input
covariance matrix. The matrix is required to be symmetric and positve
semi-definite (PSD). The current behavior is that NumPy raises a warning if
the matrix is not PSD, and does not even check for symmetry.

I added a symmetry check, which raises a warning when the input is not
symmetric. And added two keyword args which users can use to turn off the
checks/warnings when the matrix is ill formed. So this would only cause
another new warning to be raised in existing code.

This is needed because sometimes the covariance matrix is only *almost*
symmetric or PSD due to roundoff error.

Thoughts?


PR: https://github.com/numpy/numpy/pull/5726
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150329/3aca694f/attachment.html>


More information about the NumPy-Discussion mailing list