Feat - Pegasos Quantum Kernel Alignment - #1069
Open
JohnKerf wants to merge 6 commits into
Open
Conversation
JohnKerf
marked this pull request as ready for review
September 3, 2026 11:04
JohnKerf
requested review from
OkuyanBoga,
adekusar-drl and
oscar-wallis
as code owners
September 3, 2026 11:04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Details and comments
The majority of the PegasosQKA code follows from https://zenodo.org/records/7804477 but has been stripped back to make the implementation more streamlined.
Decided not to include the self._blasphemy logic (computing kernel without historical thetas) as this is not how the algorithm is intended to be ran.
Decided at this time not to include a callback however this could be a possible future feature.
Precomputed kernel functionality is not needed for QKA since by design we change the kernel throught the algorithm.
Decided warm starting and calibration/recalibration is not needed. It seems calibration was not used in the paper and adds a lot of extra bloat to the algorithm so I thought it was best to not include it (
learning_rateandperturbationsare passed as fixed variables).To be able to cleanly inherit PegasosQSVC I extracted the step update logic into its own function
_update_stepand also the kernel evaulation logic into_evaluate_kernel. This meant we can cleanly overide these in the PegasosQKA class and reuse the bulk of the QSVC algorithm.Previously the trainable kernels did not have the option to set seperate paramters for the left and right feature maps. The paper logic introduced a new pseudo kernel but to avoid adding this I have introduced the ability to run and evaluate the trainable kernels with the seperate left and right parameters.
AI Disclosure - *ChatGPT was used in this work primarily to help with producing tests and also helped me better understand the PegasosQSVC/PegasosQKA algorithms. The main body of code already existed from the paper source code and all implementation/checks were done by myself. I fully understand the code I have produced but I will note that during the process ChatGPT did help verify/clarify some of the logic I was imlpementing. *