Skip to content
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

[Bug] Normalize probabilities #53

Merged
merged 5 commits into from
Apr 21, 2022
Merged

[Bug] Normalize probabilities #53

merged 5 commits into from
Apr 21, 2022

Conversation

albi3ro
Copy link
Contributor

@albi3ro albi3ro commented Apr 21, 2022

The returned probabilities do not always perfectly sum to one. This difference seems to be slight, about 1e-5, but it is enough to cause np.random.choice to complain. Therefore we now normalize the probabilities.

@codecov
Copy link

codecov bot commented Apr 21, 2022

Codecov Report

Merging #53 (4761bea) into master (8cd59b6) will increase coverage by 0.07%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #53      +/-   ##
==========================================
+ Coverage   88.77%   88.85%   +0.07%     
==========================================
  Files           5        5              
  Lines         285      287       +2     
==========================================
+ Hits          253      255       +2     
  Misses         32       32              
Impacted Files Coverage Δ
pennylane_ionq/device.py 93.39% <100.00%> (+0.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8cd59b6...4761bea. Read the comment docs.

CHANGELOG.md Outdated Show resolved Hide resolved
@albi3ro albi3ro requested a review from antalszava April 21, 2022 16:20
Copy link
Contributor

@antalszava antalszava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@albi3ro were the failures that we've seen results of a stochastic behaviour?

CHANGELOG.md Outdated
@@ -6,11 +6,16 @@
`SimulatorDevice` class for general IonQ devices.
[(#50)](https://github.com/PennyLaneAI/PennyLane-IonQ/pull/50)

### Bug Fixes

* Since the probabilities returned don't always perfectly sum to one, they are now normalized.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What probabilities are referred to here? Maybe good to rephrase from the user's point of view.

@albi3ro
Copy link
Contributor Author

albi3ro commented Apr 21, 2022

@antalszava When running an individual circuit locally, the errors were stochastic.

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@antalszava antalszava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for the updates here 👏

@antalszava antalszava merged commit 7580077 into master Apr 21, 2022
@antalszava antalszava deleted the normalize_probabilities branch April 21, 2022 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants