-
Notifications
You must be signed in to change notification settings - Fork 848
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
adding QML with Classiq notebook #180
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
@@ -0,0 +1,1203 @@ | |||
{ |
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.
Overall, looks like a good start for a Classiq user who wants to explore QML with our platform. It might be nice to have a paragraph introducing QML itself and what Classiq uniquely offers for users who want to explore QML. One of the unique things can be an easy and abstracted method to optimize algorithms, which is an important factor for someone working on QML.
Reply via ReviewNB
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.
Eden intended it for those familiar with QML but new to exploring it with Classiq (researchers, etc.), so I assumed the reader is familiar with the concepts but not the platform. Perhaps I should emphasize this more clearly.
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.
Sure then, sounds good.
@@ -0,0 +1,1203 @@ | |||
{ |
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.
It could be unclear to the user why suddenly we talk about a hamiltonian. The introduction paragraph below the subtitle "Using the VQE Primitive" can include a short explanation about VQE and how it helps in finding the ground state energy of a system, mentioning that the hamiltonian represents the system's energy landscape.
Reply via ReviewNB
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.
I see your point. I will clarify that the matrix is the Hamiltonian from the begining. Regarding the ground state energy, I think it is out of the scope of the tutorial, as I assume the reader is familiar with the algorithm and its initial application. Here, we aim to showcase the "how-to" with Classiq, and the VQE primitive could be used for many other use cases beyond finding the ground state energy (if you manage to map the problem to a Hamiltonian).
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.
:)
@@ -0,0 +1,1203 @@ | |||
{ |
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.
Overall, looks like a good start for a Classiq user who wants to explore QML with our platform.
- I think it might be nice to mention here a short phrase along the lines of "Notice that we use the @cfunc descriptor to define a classical execution function in Classiq".
- It might be good to explain why using the classical function will let us harness the power of VQE
Reply via ReviewNB
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, got it.
- Well, I believe it's clear from the context that it allows us to initialize all the required parameters and information in one place. I meant to focus on the convenience of it rather than the technical idea of the feedback loop. Please let me know if you have further suggestions.
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.
I see where you're coming from. Sure, going again to resolve this comment
@@ -0,0 +1,1203 @@ | |||
{ |
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.
In addition to these 3 results, energy fluctuation might be an interesting result to add, if feasible because it might be of interest to researchers. I believe it's usually good to have lower fluctuations throughout so that algo converges nicely towards GS energy. Not sure if this is currently possible with in-built functions in Classiq though.
Reply via ReviewNB
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.
As mentioned, it is not necessarily for energy but in a broader context of QML and optimization. Anyway, currently, there is no "fluctuation" parameter in the results of the VQE module. I am also unsure what you mean by that in the context of VQE (standard deviation?). If you have any references or further clarification, I would appreciate it.
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.
I meant in the context of as the state evolves, the energy of the hamiltonian evolves too and if the energy varies too much, it's seen that the algorithm might not converge accurately. But this is only in the context of trying to find the ground state energy.
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.
Well, for that reason the user may define the "max_iteration" and "tolerance" arguments. I still don’t understand what you mean by "if the energy varies too much". Is it in the context of standard deviation?
I have added the standard deviation of the last iteration, but I believe plotting all of them is unnecessary and easy to understand at this point for the user if needed.
Please let me know if you have further notes here, or if there are other issues to resolve. 🙏🏽
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.
Ok I had removed the std as it was not the std of the final eigenvalue, for having that a user will have to run the algorithm multiple times.
I believe that you are referring is visible from the plot.
@@ -0,0 +1,1203 @@ | |||
{ |
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.
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.
Definitely, I called it "Exercise - Two Qubits VQE", unsure why it's not visible here.
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.
I still can't view it as Exercise but maybe it's just a glitch. All good if it's visible to you. Resolving
@@ -0,0 +1,1203 @@ | |||
{ |
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.
This is nice since our reader might be familiar with Classiq and quantum computing but not PyTorch! :)
Reply via ReviewNB
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 :)
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.
:)
@@ -0,0 +1,1203 @@ | |||
{ |
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.
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.
It's an issue of the ReviwNB rendering, The naming is indeed different.
@@ -0,0 +1,1203 @@ | |||
{ |
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.
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.
Same
PR Description
Some notes
Please make sure that you placed the files in an appropriate folder
And that the files have indicative names.
Please note that Classiq runs automatic code linting, which may minorly alter some files.
pre-commit
, you may runpre-commit install
, and then at each commit, your files will be altered in a similar way