-
Notifications
You must be signed in to change notification settings - Fork 215
Add quantum kernel pre-screening demo based on Huang et al. #1569
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
base: master
Are you sure you want to change the base?
Add quantum kernel pre-screening demo based on Huang et al. #1569
Conversation
this is for validation and make a preview
Your preview is ready 🎉!You can view your changes here
|
|
Hi @daniela-angulo , I checked the preview and some things did not render properly, do I need to do anything? |
|
Hi @andynader, yeah, I saw that. |
|
Hi @andynader, I think I addressed all the formatting issues. Could you verify that for me? Is the demo looking the way it is intended to? |
|
Hi Daniela, thank you for your hard work. I changed the code as you recommended; should we also make some figures such as the scatter plot and embedding circuit plots smaller or do you think they're good? |
|
Yes, I think we could probably do that. |
Hi Daniela, yes he told me you have an in house graphic designer who can make them, how should I move forward? Should I contact Ben? |
|
I will also work on making the figures smaller this weekend and push the changes |
|
Hi! |
daniela-angulo
left a comment
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.
Such a cool demo, the main idea is clearly well presented.
I only added a few comments. Thanks!
| @@ -0,0 +1,773 @@ | |||
| r"""Is a Quantum Kernel Worth Exploring? A ‘:math:`g`-first’ Reality Check | |||
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 this your preferred title or the on in the metadata file? they are different
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.
Updated to match the metadata, haven't committed yet though.
| From a practitioner’s perspective, such a **pre-screening test** is invaluable: it lets us rule out | ||
| quantum kernels that don’t offer any potential quantum advantage right from the start. | ||
|
|
||
| Huang *et al.* (https://arxiv.org/abs/2011.01938) introduced exactly this test. Their proposed |
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 should have a reference section at the end, before the appendix. It doesn't matter if all we cite is the same article several times.
You can take a look at other demos in the open PRs in the repo #1577
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 the best way to incorporate this directly into the demo file, put the reference here, or in the notebook and then convert again?
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.
best to do it in the demo file directly. If you run into difficulties, let me know, and I'll help.
| # :math:`K_{\text{RBF}}` obtained from: | ||
| # | ||
| # .. math:: k_{\text{RBF}}(x, x') = \exp(-\gamma \|x - x'\|^2) | ||
| # | ||
| # :math:`K_{\text{QK-E1}}` obtained from: | ||
| # | ||
| # .. math:: k_{\text{QK-E1}}(x, x') = |\langle \psi_{\text{E1}}(x) \mid \psi_{\text{E1}}(x') \rangle|^2 | ||
| # | ||
| # :math:`K_{\text{QK-E2}}` obtained from: | ||
| # | ||
| # .. math:: k_{\text{QK-E2}}(x, x') = |\langle \psi_{\text{E2}}(x) \mid \psi_{\text{E2}}(x') \rangle|^2 | ||
| # | ||
| # :math:`K_{\text{PQK-E1}}` obtained from: | ||
| # | ||
| # .. math:: k_{\text{PQK-E1}}(x, x') = \exp\left( -\gamma \|v_{\text{E1}}(x) - v_{\text{E1}}(x')\|^2 \right) | ||
| # | ||
| # :math:`K_{\text{PQK-E2}}` obtained from: | ||
| # | ||
| # .. math:: k_{\text{PQK-E2}}(x, x') = \exp\left( -\gamma \|v_{\text{E2}}(x) - v_{\text{E2}}(x')\|^2 \right) |
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 think we might leave this out since it is repeated from the above equations. Just to shorten up the demo a bit.
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.
No problem. Should I update myself?
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.
yes! go for it
| # - The role of :math:`g` is *not* to predict which kernel will perform best on a given task, but | ||
| # rather to obtain a collection of kernels that have the *potential* to offer an advantage. | ||
| # | ||
| # Here, PQK-E1 and PQK-E2 both had the potential for an advantage over classical, but PQK-E2 is the |
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.
over classical kernels or classical ...?
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.
Over classical kernels, but the authors found that this holds true for other algorithms too. Should I add this?
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.
yes, it is possible.
Co-authored-by: Daniela Angulo <[email protected]>
Co-authored-by: Daniela Angulo <[email protected]>
Co-authored-by: Daniela Angulo <[email protected]>
Co-authored-by: Daniela Angulo <[email protected]>
Co-authored-by: Daniela Angulo <[email protected]>
Co-authored-by: Daniela Angulo <[email protected]>
|
Thanks for your hard work @daniela-angulo, I committed the suggestions, hope this didn't break anything. What's left is to make the figures smaller, and include the changes in my replies to your comments. Can I pull the latest changes and update myself? |
|
Thanks for reviewing this, @andynader . Yes, you can update the changes yourself and commit them to the repo. |
|
Hi, I wanted to let you know I will be away for the next three weeks. I will continue working on the demo once I am back. Thank you! |
|
Absolutely, thank you for your hard work Daniela! |
Title:
Before You Train: Pre-screening Quantum Kernels with Geometric Difference
Summary:
This demo implements the geometric difference metric (g) from Huang et al. (2021) for pre-screening quantum kernels before training. The metric quantifies how differently a quantum kernel's geometry represents data compared to a classical kernel, allowing practitioners to identify promising quantum approaches early and avoid wasting time on kernels with no potential advantage. Using synthetic two-moons data, we demonstrate how to calculate g for multiple quantum kernel variants (fidelity-based and projected) and interpret the results to guide kernel selection.
Relevant references:
Possible Drawbacks:
None
Related GitHub Issues:
None
GOALS — Why are we working on this now?
Provide practitioners with a practical tool for quantum kernel evaluation. Address a common pain point where researchers spend significant time tuning quantum kernels that fundamentally cannot outperform classical ones.
AUDIENCE — Who is this for?
QML researchers and practitioners working with quantum kernels, ML engineers exploring quantum advantages, and anyone interested in practical quantum machine learning workflows.
KEYWORDS:
quantum kernels, geometric difference, pre-screening, kernel methods, SVM, quantum machine learning, quantum advantage
Which type of documentation?