mitiq icon indicating copy to clipboard operation
mitiq copied to clipboard

First demo of learning function

Open Misty-W opened this issue 2 years ago • 2 comments

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

Misty-W avatar Sep 27 '22 23:09 Misty-W

Binder :point_left: Launch a binder notebook on branch unitaryfund/mitiq/learning-based-example-mw

github-actions[bot] avatar Sep 27 '22 23:09 github-actions[bot]

Codecov Report

Merging #1514 (405f1e5) into master (9d39a44) will increase coverage by 0.02%. The diff coverage is n/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.

codecov[bot] avatar Sep 28 '22 00:09 codecov[bot]

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).

Misty-W avatar Oct 15 '22 23:10 Misty-W

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.

nathanshammah avatar Oct 16 '22 15:10 nathanshammah

Thanks @Misty-W. Just to clarify, a side comment because there are a couple of PRs open:

Let’s keep the PR for the user guide open and I’ll update it after this PR is closed.

Yes, I plan to update this in the next week.

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.

Misty-W avatar Oct 16 '22 18:10 Misty-W

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.

Misty-W avatar Oct 18 '22 23:10 Misty-W

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?

Misty-W avatar Oct 20 '22 23:10 Misty-W

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 !

Misty-W avatar Oct 21 '22 18:10 Misty-W