-
Notifications
You must be signed in to change notification settings - Fork 325
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 initialisation with default parameters #248
Fix vqc initialisation with default parameters #248
Conversation
Fixes qiskit-community#217 where ```VQC``` couldn't be instantiated unless either ```feature_map``` or ```ansatz``` were provided. ```VQC``` is now instantiated with the default ```feature_map``` and/or ```ansatz```. Changelog: Bugfix
Fixes qiskit-community#217 where ```VQC``` couldn't be instantiated unless either ```feature_map``` or ```ansatz``` were provided. ```VQC``` is now instantiated with the default ```feature_map``` and/or ```ansatz```. Changelog: Bugfix
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.
Thanks a lot, looks good! Nice to see you are back. I left just minor comments. Could you please take a quick look if VQR
does not have the same problem.
releasenotes/notes/fix-vqc-initialisation-bdf753c45b66f192.yaml
Outdated
Show resolved
Hide resolved
# pylint: disable=invalid-name | ||
X = algorithm_globals.random.random((num_samples, num_inputs)) | ||
y = 1.0 * (np.sum(X, axis=1) <= 1) | ||
while len(np.unique(y)) == 1: | ||
X = algorithm_globals.random.random((num_samples, num_inputs)) | ||
y = 1.0 * (np.sum(X, axis=1) <= 1) | ||
y = np.array([y, 1 - y]).transpose() # VQC requires one-hot encoded input |
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.
Oh, this snippet is everywhere, datasets should be organized in a better way. But this is not a request to this PR.
thanks @adekusar-drl I checked and The behaviour of the init method is very different though. In the init method of |
Oh, thanks for looking into this, all correct! |
* Summary: Fixes qiskit-community#217 where ```VQC``` couldn't be instantiated unless either ```feature_map``` or ```ansatz``` were provided. ```VQC``` is now instantiated with the default ```feature_map``` and/or ```ansatz```. Changelog: Bugfix * Summary: Fixes qiskit-community#217 where ```VQC``` couldn't be instantiated unless either ```feature_map``` or ```ansatz``` were provided. ```VQC``` is now instantiated with the default ```feature_map``` and/or ```ansatz```. Changelog: Bugfix * add docstring to test * Update releasenotes/notes/fix-vqc-initialisation-bdf753c45b66f192.yaml Co-authored-by: Anton Dekusar <[email protected]> Co-authored-by: jonvet <[email protected]> Co-authored-by: Manoel Marques <[email protected]> Co-authored-by: Anton Dekusar <[email protected]>
Summary
Fixes #217 where
VQC
couldn't be instantiated unless eitherfeature_map
oransatz
were provided.VQC
is now instantiated with the defaultfeature_map
and/oransatz
.Details and comments
Changelog: Bugfix