Remove need for num_features before fitting - #301
Merged
MoritzWillmann merged 152 commits intoAug 20, 2025
Merged
Conversation
added 29 commits
August 14, 2024 16:55
…d quantum kernel and the Support Vector HLM's
- Extract initialization logic for the FidelityKernel and ProjectedQuantumKernel into a new method "initialize_kernel", which is called within the fit methods of the high-level classes. - Separate the initialization logic for QSVR and QSVC into their own "initialize_kernel" methods, which also invoke the underlying "initialize_kernel" methods of the Fidelity or Projected Kernel.
…other kernel classes
make sure the kernel is fully initialised in the evaluate method before evaluating it. This is necessary to deal with kernel cloning in some cases.
…tures for the QNN classes
this is no longer supported since the constructors have changed and the underlying `LayeredPQC` gets not build in the `__init__` directly
…ans/squlearn into remove_num_features
…uantum framework specific circuit in the init of the `LowLevelQNN`
MoritzWillmann
approved these changes
Aug 20, 2025
MoritzWillmann
left a comment
Collaborator
There was a problem hiding this comment.
Looks good now, LGTM
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.
Changes Made
1. Delayed Initialization of High-Level Methods
num_featuresparameter is no longer required during the instantiation of high-level methods.num_featuresis not provided, the complete initialization of the high-level method is postponed until thefitmethod is called, allowing the actual number of features to be known.num_featuresis provided during instantiation, the high-level method will be fully initialized immediately.2. New
num_encoding_slotsProperty forEncodingCircuitnum_encoding_slotshas been introduced for eachEncodingCircuit, which calculates the number of encoding slots individually.get_circuitmethod, there is now a check to ensure that the number of provided features matches the number of available encoding slots.EncodingSlotsMismatchErroris raised.closes #266, #292