-
Notifications
You must be signed in to change notification settings - Fork 31
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
Warning: Numerical error in covariance estimation causing positive semidefinite violation #151
Comments
Here is a small example so you can reproduce this. Any advice welcome.
|
Hi @mikedeltalima thanks for the example. I haven't used the tomography stuff too much, so I'm not super familiar with the conventions it uses, but if you look at your
What we see is that the negativity is coming from the first parameter, which is your coefficient on the identity Pauli. This looks to be numerical error from 0, because your model or prior does not allow anything other that 1/sqrt(2). So my suggestion is to add some variance to your prior in this parameter (if it is sensible for you), or to disclude this parameter from your model (I'm not actually sure how difficult this is with the tomography module), or finally, I think this error can safely be ignored. It can be ignored because having thin manifolds in your posterior is not actually a problem, just a numerical waste, and the warning is just randomly being triggered off of that. Note that if you look at, eg, your posterior mean ( |
Thanks @ihincks! Is there a way to parameterize my density matrices to get rid of the extra degree of freedom? Also, or alternatively, would it make sense to always return a positive covariance matrix? We could include a warning on a more verbose setting. |
I'm not sure how to drop the identity out of your parameterization. There may be an easy way, but I don't see it after a quick glance. I personally wouldn't bother. We probably want to change to something like the following check in utils.py:
|
@ihincks I can submit a pull request for that. Should there be an option to correct the covariance to zero? |
Sounds great. Yes, I suppose we should clip the covariance if we're computing the eigenvalues anyway.
(did not check) |
I'm getting the following warning. Is it something I need to worry about?
The text was updated successfully, but these errors were encountered: