squlearn icon indicating copy to clipboard operation
squlearn copied to clipboard

Remove need for `num_features` before fitting

Open DennisKleinhans opened this issue 1 year ago • 2 comments

Changes Made

1. Delayed Initialization of High-Level Methods

  • The num_features parameter is no longer required during the instantiation of high-level methods.
  • If num_features is not provided, the complete initialization of the high-level method is postponed until the fit method is called, allowing the actual number of features to be known.
  • If num_features is 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_slots has been introduced for each EncodingCircuit, which calculates the number of encoding slots individually.
  • In the get_circuit method, 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 EncodingSlotsMismatchError is raised.

closes #266, #292

DennisKleinhans avatar Oct 25 '24 09:10 DennisKleinhans

Hey @DennisKleinhans thanks for your contribution! Please make sure, that all tests, notebooks and docs work 😄 Cheers Moritz

MoritzWillmann avatar Oct 27 '24 17:10 MoritzWillmann

Please check layered_encoding_circuit.py, random_encoding_circuit.py, random_layered_encoding_circuit.py, pruned_encoding_circuit.py and transpiled_encpding_circuit.py

David-Kreplin avatar Nov 22 '24 09:11 David-Kreplin