Skip to content

Conversation

andynader
Copy link

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?

  • Tutorial
  • Demo
  • How-to
Copy link

github-actions bot commented Oct 6, 2025

Your preview is ready 🎉!

You can view your changes here

@andynader
Copy link
Author

Hi @daniela-angulo , I checked the preview and some things did not render properly, do I need to do anything?

@daniela-angulo
Copy link
Contributor

Hi @andynader, yeah, I saw that.
Not for now, let me try to fix a few things and I'll loop you in when I have finished the demo so you can address all the suggestions and/or changes at once.
Thanks.

@daniela-angulo
Copy link
Contributor

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?
I have not yet reviewed it, but I will this week. However, I noted a few things in the PR as comments regarding two figures. We can start with these two things and then move forward to the review when I get to it.
Thank you!

Comment on lines +207 to +213
print("E1 Embedding Circuit:")
fig, ax = qml.draw_mpl(embedding_E1)(np.zeros(n_qubits))
plt.show()

print("\nE2 Embedding Circuit:")
fig, ax = qml.draw_mpl(embedding_E2)(np.zeros(n_qubits))
plt.show()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these lines are not going to plot the figures as intended. It is plotting the figures first and then printing the text (see rendering). Could you add those E1 and E2 as titles for the figures? if that's too annoying, I guess we can start a new code block for the E2 figure haha, as a way to circumvent this, let me know.

Comment on lines +365 to +367
plt.tight_layout()
plt.suptitle(f"Gram Matrix Visualizations (first {subset_size}×{subset_size} entries)", y=1.02)
plt.show()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these figures are very pretty but one can barely see them, maybe another layout could be better? like a (2,3) array?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants