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

added plot_probabilities method in result class #82

Merged
merged 8 commits into from
Oct 5, 2022

Conversation

EmilianoG-byte
Copy link
Contributor

@EmilianoG-byte EmilianoG-byte commented Sep 16, 2022

Description

  • Added a plot_probabilities method under the result class
  • Nice and easy visualisation of the probabilities obtained for the basis states after the optimisation workflow.
  • works for both state vector and shot based back-ends
  • note: can add an additional argument to decide whether to plot states with zero probability or not.

Checklist

  • I have performed a self-review of my code.
  • I have commented my code and used numpy-style docstrings
  • I have made corresponding updates to the documentation.
  • My changes generate no new warnings
  • I have added/updated tests to make sure bugfix/feature works.
  • New and existing unit tests pass locally with my changes.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Via UnitTest in the test_result_object.py file. Both for 'vectored' and 'qiskit.shot_simulator'.

@Q-lds Q-lds self-assigned this Sep 17, 2022
openqaoa/optimizers/result.py Outdated Show resolved Hide resolved
@vishal-ph vishal-ph changed the base branch from main to dev September 29, 2022 05:16
@Q-lds Q-lds added the enhancement New feature or request label Sep 30, 2022
@codecov
Copy link

codecov bot commented Sep 30, 2022

Codecov Report

Merging #82 (18d063b) into dev (431b683) will decrease coverage by 3.35%.
The diff coverage is 81.05%.

@@            Coverage Diff             @@
##              dev      #82      +/-   ##
==========================================
- Coverage   92.84%   89.48%   -3.36%     
==========================================
  Files          60       63       +3     
  Lines        7629     8150     +521     
==========================================
+ Hits         7083     7293     +210     
- Misses        546      857     +311     
Impacted Files Coverage Δ
openqaoa/backends/qaoa_backend.py 70.27% <ø> (ø)
openqaoa/backends/simulators/qaoa_qiskit_sim.py 100.00% <ø> (ø)
openqaoa/basebackend.py 86.80% <ø> (ø)
openqaoa/qaoa_parameters/gatemap.py 88.02% <0.00%> (ø)
openqaoa/qaoa_parameters/operators.py 100.00% <ø> (ø)
openqaoa/workflows/optimizer.py 83.33% <ø> (ø)
setup.py 100.00% <ø> (ø)
tests/test_results.py 100.00% <ø> (ø)
tests/test_qpu_qiskit.py 11.01% <23.52%> (ø)
openqaoa/cost_function.py 60.00% <28.57%> (-3.64%) ⬇️
... and 23 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

openqaoa/optimizers/result.py Outdated Show resolved Hide resolved
openqaoa/optimizers/result.py Outdated Show resolved Hide resolved
@Q-lds
Copy link
Member

Q-lds commented Oct 4, 2022

Ok! Besides the potential issue regarding the Pauli op error, I think this PR is ready to be merged! (cc @vishal-ph )

@vishal-ph
Copy link
Collaborator

Ok! Besides the potential issue regarding the Pauli op error, I think this PR is ready to be merged! (cc @vishal-ph )

I see, there are still some changes requested by Shahidee. Are those already implemented? If yes, lets resolve the comments and we can proceed with merge

@EmilianoG-byte
Copy link
Contributor Author

Ok! Besides the potential issue regarding the Pauli op error, I think this PR is ready to be merged! (cc @vishal-ph )

I see, there are still some changes requested by Shahidee. Are those already implemented? If yes, lets resolve the comments and we can proceed with merge

You man regarding the use of plt.show(), right? With my version of Matplotlib it is not necessary. I am unsure what version is Shahidee using

@vishal-ph vishal-ph merged commit fad1904 into entropicalabs:dev Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants