mitiq
mitiq copied to clipboard
First demo of learning function
Description
fixes https://github.com/unitaryfund/mitiq/issues/1280
License
- [x] I license this contribution under the terms of the GNU GPL, version 3 and grant Unitary Fund the right to provide additional permissions as described in section 7 of the GNU GPL, version 3.
Before opening the PR, please ensure you have completed the following where appropriate.
- [x] I added unit tests for new code.
- [x] I used type hints in function signatures.
- [x] I used Google-style docstrings for functions.
- [x] I updated the documentation where relevant.
- [x] Added myself / the copyright holder to the AUTHORS file
Codecov Report
Merging #1514 (405f1e5) into master (9d39a44) will increase coverage by
0.02%
. The diff coverage isn/a
.
:exclamation: Current head 405f1e5 differs from pull request most recent head 9f5355f. Consider uploading reports for the commit 9f5355f to get more accurate results
@@ Coverage Diff @@
## master #1514 +/- ##
==========================================
+ Coverage 98.19% 98.21% +0.02%
==========================================
Files 62 63 +1
Lines 2881 2918 +37
==========================================
+ Hits 2829 2866 +37
Misses 52 52
Impacted Files | Coverage Δ | |
---|---|---|
mitiq/zne/scaling/__init__.py | 100.00% <0.00%> (ø) |
|
mitiq/zne/scaling/identity_insertion.py | 100.00% <0.00%> (ø) |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
Added a label in pec.myst
for linking to the PEC section of the user guide (instead of re-explaining PEC in the text of the example).
Thanks @Misty-W. Just to clarify, a side comment because there are a couple of PRs open:
- https://github.com/unitaryfund/mitiq/pull/1395: this PR needs to be updated for the user guide section of the docs, correct? Or shall we close it? I would at least add some information in the PEC users guide under "advanced options" file 4.
- https://github.com/unitaryfund/mitiq/pull/1510: this is WIP
- https://github.com/unitaryfund/mitiq/pull/1491: this has been put on hold, if I understand correctly
I can provide comments on this PR.
Thanks @Misty-W. Just to clarify, a side comment because there are a couple of PRs open:
- Write user guide section for learning-based PEC #1395: this PR needs to be updated for the user guide section of the docs, correct? Or shall we close it? I would at least add some information in the PEC users guide under "advanced options" file 4.
Let’s keep the PR for the user guide open and I’ll update it after this PR is closed.
- Learn biased noise parameters #1510: this is WIP
Yes, I plan to update this in the next week.
- Unmitigated version of learning-based PEC #1491: this has been put on hold, if I understand correctly
Yes, let’s revisit the plan after the other open learning-based PEC PRs are closed.
I can provide comments on this PR.
Great, thanks! I added you as a reviewer.
Thanks for the review @natestemen!
Some general feedback:
- Some more explanation between cells might be helpful instead of describing what the code is doing.
Agreed, I've replaced some of the descriptive text with explanations. Let me know what in particular needs additional clarification- it helps to get another perspective!
- Inserting some references to learning based PEC would be great! Got to help people sink their teeth in if they want to.
Thanks for the reminder! I added a citation to the learning-based quantum error mitigation paper, as well as links to the PEC and CDR sections of the user guide and API-doc.
Some technical feedback:
- Some of the lines are really long, which makes it slightly harder to read and give feedback on, especially using GitHub's "suggestion" tool. A line limit on this file might be good, but my favorite way to do it in markdown/markup languages is to stick to a one sentence per line rule.
Good point, I've imposed both.
- The git history on this PR seems to have gotten jumbled, and it's hard to follow how we got to the current state. There are a few commits touching files that are not involved with this PR which is very strange. Happy for you (or I) to rewrite history to clean it up.
Something weird happened to the branch, and it took multiple tries to update it. I didn't think it was possible to rewrite the commit history after pushing to GitHub, but it'd be nice to clean it up.
Thanks @Misty-W, I left some optional suggestions. Do you have any idea of how long is the execution time? Comparing with docs build time on master this seems 15-20 min longer but maybe I am wrong.
Thanks for the suggestions @andreamari!
Although I've increased the number of moments in the circuit (5 --> 10), I was able to bring the build time down to 25 min (same as latest commit on master 4ea99b4) by reducing the number of points calculated for the loss function plot.
Anything else that should be addressed before merging?
Nice work Misty! I really like this example. It's clear, and shows a nice clear advantage while using this technique.
I've left 3 comments, all of which are optional changes.
Thanks @natestemen !