squlearn
squlearn copied to clipboard
Remove need for `num_features` before fitting
Changes Made
1. Delayed Initialization of High-Level Methods
- The
num_featuresparameter is no longer required during the instantiation of high-level methods. - If
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. - If
num_featuresis provided during instantiation, the high-level method will be fully initialized immediately.
2. New num_encoding_slots Property for EncodingCircuit
- A new property called
num_encoding_slotshas been introduced for eachEncodingCircuit, which calculates the number of encoding slots individually. - In the
get_circuitmethod, there is now a check to ensure that the number of provided features matches the number of available encoding slots. - If there are not enough encoding slots for all features, an
EncodingSlotsMismatchErroris raised.
closes #266, #292
Hey @DennisKleinhans thanks for your contribution! Please make sure, that all tests, notebooks and docs work 😄 Cheers Moritz
Please check layered_encoding_circuit.py, random_encoding_circuit.py, random_layered_encoding_circuit.py, pruned_encoding_circuit.py and transpiled_encpding_circuit.py