classiq-library icon indicating copy to clipboard operation
classiq-library copied to clipboard

Shadows

Open gzemlevskiy17 opened this issue 8 months ago β€’ 24 comments

PR Description

Implement a demo of the classical shadows algorithm.

I was unsure on how to use rebase or pre-commit.

Some notes

  • [x] Please make sure that the notebook runs successfully with the latest Classiq version.

  • [x] Please make sure that you placed the files in an appropriate folder

    • [x] And that the file names are clear, descriptive, and match the notebook content.
      • [x] Note that we require the file names of .ipynb and .qmod to be unique across this repository.
    • [x] Plus, please make sure that all required files are included: .qmod, .synthesis_options.json, .metadata.json
    • [x] And that images are embedded inside the notebook, not added as external files
  • [x] If applicable, please include link to the paper on which the notebook is based, in the notebook itself.

  • [ ] Please use rebase on your branch (no merge commits)

  • [x] Please link this PR to the relevant issue

  • [ ] Please make sure to run pre-commit when commiting changes

    • [ ] If you're using git in the terminal, make sure to install pre-commit via running pip install pre-commit followed by pre-commit install
    • [ ] Note that Classiq runs automatic code linting. Meaning that one of the tests verifies the output of pre-commit.
    • [ ] Also note that pre-commit may minorly alter some files. Make sure to git add the changes done by pre-commit

gzemlevskiy17 avatar Apr 22 '25 08:04 gzemlevskiy17

Check out this pull request onΒ  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@gzemlevskiy17 are you still working on this?

TomerGoldfriend avatar May 19 '25 05:05 TomerGoldfriend

@TomerGoldfriend Yes, sorry I was working on developing the Classiq challenge for the FLIQ hackathon. I will update this PR soon.

gzemlevskiy17 avatar May 20 '25 02:05 gzemlevskiy17

Hi @gzemlevskiy17 ! Still plan to complete this project?

NadavClassiq avatar Jun 29 '25 08:06 NadavClassiq

Hi @NadavClassiq. Yes! The project is finished, but I am still figuring out how to adhere to the contributing guidelines. I actually have a few questions:

I ran pre-commit and one test did not pass, specifically:

Auto add test............................................................Failed
- hook id: auto-add-tests
- exit code: 1

Executable `.internal/pre_commit_tools/auto_add_tests.py` is not executable

What should I do about this?

Also, since classical shadows involves applying random unitary gates, the circuit, and thus the quantum model, vary, so I don't know if I should generate a .qmod file as per the guidelines.

Finally, I am unsure of the git workflow I should follow, particularly where rebase comes in.

gzemlevskiy17 avatar Jun 29 '25 15:06 gzemlevskiy17

Hi @gzemlevskiy17!

  1. Custom auto tests are not required in the community/paper_implementation_project/, which is where you should first contribute. We might later on move the notebook to a different location, and take care the testing issue.

  2. Regarding the qmods, if you can make it work in a reproducible way, using a random seed, that would be great :) Anyway, qmods are required, at least the final one. Whenever you are done, I will take a closer look and, worst case, will give a note.

  3. Regarding the GitHub workflow, you don't really need to rebase at the moment, as only you work on these files. Rebase is used to take your branch and add newer changes that were rebased and merged while you were still working.

Lmk if you need further help :)

NadavClassiq avatar Jun 30 '25 08:06 NadavClassiq

@NadavClassiq Thank you!

If I am contributing to community/, what would I write for the qmod_type and level tags in the metadata.json file? Also, the paper name is "Predicting Many Properties of a Quantum System from Very Few Measurements", which is very long. Should I use that name for the filenames or is it fine if I named all the files "classical_shadows..."

gzemlevskiy17 avatar Jun 30 '25 12:06 gzemlevskiy17

Hi @gzemlevskiy17 !

You can use a shorter name, just write the full name with a proper link in the notebook. Regarding the metadata.json, just keep it as it is from the algorithm you have copied it from.

Lmk if you need anything else :)

NadavClassiq avatar Jul 09 '25 07:07 NadavClassiq

@NadavClassiq I've pushed my latest changes.

One part of my code uses a list of PauliTerms as a Hamiltonian, but since that has been deprecated as input for ExecutionSession.estimate(), it generates a warning. I decided to keep it, because another part of my code uses hamiltonian_to_matrix(), which needs a PauliTerm.

gzemlevskiy17 avatar Jul 12 '25 03:07 gzemlevskiy17

Great Job @gzemlevskiy17 !

I'll be reviewing it soon, maybe with feedback and suggestions for improvement.

Thanks for the efforts!

NadavClassiq avatar Jul 14 '25 12:07 NadavClassiq

@gzemlevskiy17 any updates on this?

TomerGoldfriend avatar Sep 09 '25 07:09 TomerGoldfriend

@TomerGoldfriend Thank you for the suggestions! Sorry for the delay, I have had a busy start to the semester. I will be working on it this weekend.

gzemlevskiy17 avatar Sep 11 '25 02:09 gzemlevskiy17

@TomerGoldfriend I replied to some of your comments on ReviewNB, could you please take a look?

gzemlevskiy17 avatar Sep 16 '25 15:09 gzemlevskiy17

@TomerGoldfriend I replied to some of your comments on ReviewNB, could you please take a look?

Sure @gzemlevskiy17 , thanks for the update.

TomerGoldfriend avatar Sep 16 '25 20:09 TomerGoldfriend

@TomerGoldfriend Were you able to take a look at my questions? If not, please advise how to proceed, thanks!

gzemlevskiy17 avatar Sep 22 '25 21:09 gzemlevskiy17

@TomerGoldfriend Were you able to take a look at my questions? If not, please advise how to proceed, thanks!

@gzemlevskiy17 not yet, I will review until the end of this week.

TomerGoldfriend avatar Sep 23 '25 18:09 TomerGoldfriend

@gzemlevskiy17 I think I answered all your questions, please let me know if otherwise.

TomerGoldfriend avatar Sep 24 '25 20:09 TomerGoldfriend

πŸ”₯ New notebook just dropped!

@amir-naveh , @TomerGoldfriend β€” come check out this shiny new addition to our repo.

github-actions[bot] avatar Sep 27 '25 20:09 github-actions[bot]

@TomerGoldfriend I believe I fixed addressed all of your comments, could you please take a look?

gzemlevskiy17 avatar Oct 18 '25 15:10 gzemlevskiy17

@TomerGoldfriend I believe I fixed addressed all of your comments, could you please take a look?

Great @gzemlevskiy17 ! I will review.

TomerGoldfriend avatar Oct 21 '25 07:10 TomerGoldfriend

@gzemlevskiy17 any updates on this?

TomerGoldfriend avatar Nov 06 '25 13:11 TomerGoldfriend

@TomerGoldfriend I've increased the number of snapshots to 200, which yields a better result but has a longer runtime (~8 minutes).

gzemlevskiy17 avatar Nov 10 '25 18:11 gzemlevskiy17

@TomerGoldfriend I've increased the number of snapshots to 200, which yields a better result but has a longer runtime (~8 minutes).

@gzemlevskiy17 so all is good? did you go over all my recent comments (which I sent before your last commit).

TomerGoldfriend avatar Nov 20 '25 13:11 TomerGoldfriend