-
Notifications
You must be signed in to change notification settings - Fork 338
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
fixes #297: fitting in batches without all labels #317
fixes #297: fitting in batches without all labels #317
Conversation
Pull Request Test Coverage Report for Build 1855742845
💛 - Coveralls |
Could we get a test case that would fail previously that will now work with this bug fix. Since its an aspect that CI did not catch it would be good to get a unit test in there to cover it. Also don't forget the reno release note. |
I've added a new unit test that would fail without this fix. It may be necessary to revise it if and when we implement a wider range of valid label encodings in the VQC interface. I've also added a reno note for the fix. |
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.
Looks good to me!
@woodsp-ibm Do you have open question?
else: | ||
quantum_instance = self.qasm_quantum_instance |
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.
We might want to make this if
explicit in case someone adds other backends to the test input in the future.
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.
Yep, seems sensible. Done.
@woodsp-ibm Is there anything left on your radar? If not, I'll approve and merge this PR. |
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.
Is there anything left on your radar? If not, I'll approve and merge this PR.
All looks good to me. May want to create issues for the other improvements/changes that are noted in the main comment so as we don't lose them.
@declanmillar could you please post an issue(s) mentioned in this PR? |
* fixes #297: fitting in batches without all labels * test vqc with incomplete batch labels * uncomment other vqc tests * add reno note for fix of issue #297 * fix typo * remove docstring reference from reno note * make quantum instance selection explicit for vqc tests * assert that all batches assume the correct number of classes * fix style Co-authored-by: Manoel Marques <Manoel.Marques@ibm.com> (cherry picked from commit dcbd78c)
* fixes #297: fitting in batches without all labels * test vqc with incomplete batch labels * uncomment other vqc tests * add reno note for fix of issue #297 * fix typo * remove docstring reference from reno note * make quantum instance selection explicit for vqc tests * assert that all batches assume the correct number of classes * fix style Co-authored-by: Manoel Marques <Manoel.Marques@ibm.com> (cherry picked from commit dcbd78c) Co-authored-by: Declan Millar <declan.millar@ibm.com>
* fixes #297: fitting in batches without all labels * test vqc with incomplete batch labels * uncomment other vqc tests * add reno note for fix of issue #297 * fix typo * remove docstring reference from reno note * make quantum instance selection explicit for vqc tests * assert that all batches assume the correct number of classes * fix style Co-authored-by: Manoel Marques <Manoel.Marques@ibm.com>
Summary
Closes #297. Currently, VQC will throw an error if trained on batches of data where not all of the target labels that can be found in the full dataset are present. This is because VQC interprets the number of unique labels in the current batch as the number of classes.
Currently, VQC is hard-coded to expect one-hot encoded labels. Therefore, I suggest a small change to determine the number of classes from the shape of the label array. I have also edited the docstring to add the label encoding requirements of the current VQC implementation.
Details and comments
Related issues that I will raise separately: