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

Fix PVQD loss function #9371

Merged
merged 4 commits into from
Jan 13, 2023
Merged

Fix PVQD loss function #9371

merged 4 commits into from
Jan 13, 2023

Conversation

gentinettagian
Copy link
Contributor

Summary

The loss function in PVQD is defined as 1 - fidelity, in the current implementation it was 1 - |fidelity|².

@qiskit-bot qiskit-bot added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Jan 13, 2023
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

One or more of the the following people are requested to review this:

@coveralls
Copy link

coveralls commented Jan 13, 2023

Pull Request Test Coverage Report for Build 3912389631

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.03%) to 84.818%

Files with Coverage Reduction New Missed Lines %
src/vf2_layout.rs 3 94.74%
Totals Coverage Status
Change from base Build 3908401991: -0.03%
Covered Lines: 65562
Relevant Lines: 77297

💛 - Coveralls

Copy link
Contributor

@ElePT ElePT left a comment

Choose a reason for hiding this comment

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

Hi @gentinettagian!!! Thanks for catching this!! I was surprised that the unit tests did not find the bug before, but now I see that the only unit test that actually calls the loss function is with fidelity = 1. Given that you are already working with the algorithm, do you have any simple use case we could add as a relevant unit test here?

@woodsp-ibm woodsp-ibm added bug Something isn't working mod: algorithms Related to the Algorithms module Changelog: Bugfix Include in the "Fixed" section of the changelog labels Jan 13, 2023
@woodsp-ibm woodsp-ibm added this to the 0.23.0 milestone Jan 13, 2023
@Cryoris
Copy link
Contributor

Cryoris commented Jan 13, 2023

It's probably tricky to find a test that covers this, since the minimum is the same whether we square or not: if the optimizer used is good enough it would work with both this and the previous version. One option would be to test get_loss directly, but since there is some freedom in how the loss function is defined I think it would even be ok without a dedicated test 🙂

@ElePT
Copy link
Contributor

ElePT commented Jan 13, 2023

It's probably tricky to find a test that covers this, since the minimum is the same whether we square or not: if the optimizer used is good enough it would work with both this and the previous version. One option would be to test get_loss directly, but since there is some freedom in how the loss function is defined I think it would even be ok without a dedicated test 🙂

That would simplify things for sure :)

@ElePT ElePT merged commit a0ba547 into Qiskit:main Jan 13, 2023
ElePT pushed a commit to ElePT/qiskit that referenced this pull request Jun 27, 2023
* fixed loss function

* reno and year

* bugfix

* Update releasenotes/notes/fix-pvqd-loss-cb1ebe0258f225de.yaml

Co-authored-by: Julien Gacon <[email protected]>

Co-authored-by: Julien Gacon <[email protected]>
ElePT pushed a commit to ElePT/qiskit-algorithms-test that referenced this pull request Jul 17, 2023
* fixed loss function

* reno and year

* bugfix

* Update releasenotes/notes/fix-pvqd-loss-cb1ebe0258f225de.yaml

Co-authored-by: Julien Gacon <[email protected]>

Co-authored-by: Julien Gacon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Changelog: Bugfix Include in the "Fixed" section of the changelog Community PR PRs from contributors that are not 'members' of the Qiskit repo mod: algorithms Related to the Algorithms module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants