Update tutorials to use circuit library functions #968
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Updates the tutorials to use the newer circuit library functions rather than the former, now deprecated, (BluePrint based) classes.
Addresses the checklist item to do this as found in #945
I will note that the output from these does not do so well - e.g. 02a Training on a Real Dataset where the scores are not as good and 11 Quantum Convolutional Neural Net where it classifies incorrectly one of the horizontal lines. Now these comparisons are against the tutorials as they are checked in where they were last run some time ago. I re-ran them to make sure they all worked so this is updating the output of these notebooks too. Now you can compare these to what is published out in the docs at https://qiskit-community.github.io/qiskit-machine-learning/tutorials/index.html where the notebooks would have been executed to produce the html. You can see they more compare to what I have here rather than the execution outcomes of what is checked in.
Oh I did notice the dataset plots in 03_quantum_kernel do not look like the published ones - mine had a plain blackground rather than the patterns these have. As they look correct in the published html and I did not change anything in regards of the plotting I assumed it was just some local rendering issue. Should be able to check the docs from the build here to make sure they come out correctly in the html when they get executed here.
I will also note that the circuit output, when things are printed, is not as before. Whereas before you might have seen a block that said RealAmplitudes where the gates were hidden in that block, now you just see the gates that comprise the circuit as built by the function.
Details and comments
Note: I left this PR as just addressing the circuit library changes over to using the function replacements. I did not attempt to alter the tutorials in any other way, and do not intend to, e.g. trying to improve the outcomes where it seems it did not do as well as the outcomes in the notebooks that are presently checked in. If this is done it should be in separate PR(s).