-
Notifications
You must be signed in to change notification settings - Fork 328
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 VQC training with warm_start=True #312
Fix VQC training with warm_start=True #312
Conversation
extract the initial_point in TrainableModel from the final point of the minimization in the existing OptimizerResult object.
Pull Request Test Coverage Report for Build 1829125173
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a reno
release note with a fixes section. This is required for issues that impact/affect the public API.
Thanks for adding a unit test that checks this. This is something that we always want if we find our CI has a hole like this case where the tests did not catch it. I see you have modelled it with data after what I see is done elsewhere here. I will note that that data values could be more directly coded into the data e.g directly have an instance of the optimizer etc rather than having this indirect via string values. ddt can also input to multiple parameters and do unpacking via decorator so the test does not need to have that. I am not asking for anything to be changed merely pointing this flexibility out that you may want to look at going forwards if/when using ddt. Eg from our former Aqua code https://github.com/Qiskit/qiskit-aqua/blob/c1564af8792c6664670807614a378147fd04d28f/test/aqua/test_vqe.py#L126-L131
This PR should be labelled as |
* fixes #296 warm_start with vqc extract the initial_point in TrainableModel from the final point of the minimization in the existing OptimizerResult object. * update copyright * add units tests to check vqc warm_start * fix grammar * fix grammar * initialise -> initialize * fix typo in test docstring * add a reno for fix of #296 * fix quotes in reno report Co-authored-by: Anton Dekusar <62334182+adekusar-drl@users.noreply.github.com> (cherry picked from commit 5a02c76)
* fixes #296 warm_start with vqc extract the initial_point in TrainableModel from the final point of the minimization in the existing OptimizerResult object. * update copyright * add units tests to check vqc warm_start * fix grammar * fix grammar * initialise -> initialize * fix typo in test docstring * add a reno for fix of #296 * fix quotes in reno report Co-authored-by: Anton Dekusar <62334182+adekusar-drl@users.noreply.github.com> (cherry picked from commit 5a02c76) Co-authored-by: Declan Millar <declan.millar@ibm.com>
* fixes #296 warm_start with vqc extract the initial_point in TrainableModel from the final point of the minimization in the existing OptimizerResult object. * update copyright * add units tests to check vqc warm_start * fix grammar * fix grammar * initialise -> initialize * fix typo in test docstring * add a reno for fix of #296 * fix quotes in reno report Co-authored-by: Anton Dekusar <62334182+adekusar-drl@users.noreply.github.com>
Summary
Fixes the extraction of the initial_point in TrainableModel from the final point of the
minimization in the existing OptimizerResult object. Closes #296.
Adds unit tests to ensure VQC correctly handles warm starts.
Details and comments
As pointed out by @woodsp-ibm, "In Terra the optimizers were refactored and the old optimize method, that returned a tuple (subscriptable) was deprecated and a new method minimize was created that returns OptimizerResult object."
This is a very small fix to reflect that change and some related unit tests that would have caught the issue.