-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Increase np.isclose tolerance for mitigated expectation value assertion #7627
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
Increase np.isclose tolerance for mitigated expectation value assertion #7627
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7627 +/- ##
==========================================
- Coverage 97.50% 97.40% -0.11%
==========================================
Files 1103 1103
Lines 99707 99915 +208
==========================================
+ Hits 97222 97324 +102
- Misses 2485 2591 +106 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels a bit of an overkill to both increase the tolerance
and retry tests. I tried to run this test module repeatedly
~500 times without the retry decorator and it did not fail
once (the main branch would fail about 6 times).
Can you please remove the retry decorator?
Done ; ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
This PR updates the tolerance of the np.isclose assertion used to validate the mitigated expectation value against its ideal value. The tolerance is being increased from 4 * mitigated_stddev to 10 * mitigated_stddev.
The nature of calculating a Pauli expectation is to statistically estimate the value by sampling from measurement outcomes a finite number of times, which by chance can lead to a small probability of the result deviate from the ideal value by > 4 * standard deviations. Increasing the tolerance to 10 * mitigated_stddev can makes the test much more robust against these statistical fluctuations.
Fixes #7612