Merged
Conversation
* update paper in CITATION file * update paper in README file * fix project urls
* update qiskit intersphinx * skip broken scikit-learn version for docs * black executor
* fix pennylane executor * add last line * black tests * use QNode in qfi * remove deprecation warning * rerun examples to remove pennylane warnings
* adjust the docstrings and the type signature of the fit methods in all HLMs * removed num_features from the encoding circuits * move the initialization of the low_level_qnn into the fit method * moved neceassary code from the __init__ into the fit for the projected quantum kernel and the Support Vector HLM's * Refactor kernel initialization logic into separate methods - 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. * rename "_initialized" to "_is_initialized" * Added method initialize_kernel for the QKRR class, just like for the other kernel classes * remove num_features in get_params * rename __initialize_kernel to __initialie in the HLM's * add num_features as optional parameter for the encoding circuits * recheck the initialization in evaluate 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. * refactore * add types and docstrings * move the initialization of the low level qnn * parse array-like inputs in fit into numpy arrays * fix kernel tests * fix qnn tests * add EncodingSlotsMismatchError * add check for encoding slots in the encoding circuits * add test for encoding slots missmatch * save kwargs in _qnn_params variable * Bug Fix: Avoid generating initial_parameters when a value is already provided * wrap the lazy initialization into a single method dependen on num_features for the QNN classes * fix tests * add num_encoding_slots property and check for violating the max encoding_slots * set num_features default to None * fix tests * fix tests * add tests for automatic num_features selection * add test for EncodingSlotsMissmatchError * fix docs and examples * black * fix docs * fix example * fix docs * fix pennylane QubitDevice import warning * fix test_automatic_backend_selection * turn test_encoding_slots_mismatch_error into paramerized test * Allow the draw method to draw circuits even if num_features is not provided In case the num_features are not provided, e.g., none. The num_features will be temporarily set to the number of encoding slots and a warning will be printed. * add num_features setter in TranspiledEncodingCircuit * make QubitDevice import dependant on version * Add feature consistency check and validation * moved init code for TranspiledEncodingCircuit in get_circuit method * moved init code of PrunedEncodingCircuit into get_circuit method * Add num_features property to RandomEncodingCircuit and update config generation * move check for encoding_slots in seperate method * add tests for EncodingCircuitBase * add tests for ChebyshevPQC * add tests for ChebyshevRx * add tests for ChebyshevTower * add tests for HighDimEncodingCircuit * add tests for HubregtsenEncodingCircuit * add tests for KyriienkoEncodingCircuit * add tests for MultiControlEncodingCircuit * add tests for ParamZFeatureMap * add tests for YZ_CX_EncodingCircuit * move the random circuit generation into the get_circuit method for the RandomLayeredEncodingCircuit * adjust HighDimEncodingCircuit, RandomEncodingCurcuit and RandomLayeredEncodingCircuit to enable drawing even if num_features is set to None * add tests to ensure the drawing of the circuits does not violate the configured parameters * add a minimal fit test to ensure the encoding circuits are working properly * fix tests * Ensure qubit mapping is available befor calling get_circuit in TranspiledEncodingCircuit * remove the "test_drawing_does_not_violate_params" test from the circuit tests, since drawing is now independent * add function to extract the num_features from the input data vector X * remove all references to num_features in the kernels and replace them with a parameter in the method signatures * remove all references to num_features in the Kernel HLMs and replace it with a parameter in the method signatures * ddjusted any kernel-related changes according to the review * store the operations for the LayeredEncodingCircuit in a list and apply them in the get_circuit method * ensure the random config is availabe before calling generate_initial_parameters in the RandomEncodingCircuit * Remove num_features references in EncodingCircuits - generate_initial_parameters now requires num_features as a parameter. - The draw method now either uses num_features from the circuit (if set) or requires it as a parameter. - The feature_bounds property now returns bounds for a single feature. Use get_feature_bounds(num_features) to obtain bounds for multiple features. * adjust tests according to the new feature_bounds * extract_num_features now supports list input * apply the stored operations in the LayeredEncodingCircuit before calling the get_circuit * remove refernces to num_features in the ComposedEncodingCircuit * fix tests for the Kernel HLMs * remove num_features for calculating the number of parameters in the ParamZFeatureMap * remove unnecessary references to num_features in the QNNs * refactor tests for ChebyshevPQC to use parameterized tests for number of parameters * refactore docstring for feature_bounds * switch from `math.inf` to `np.inf` to omit additional imports * remove unnecessary imports and duplicate lines * move the feature consistency check to the `EncodingCircuitBase` class * Bug fix: num_features was overridden in draw method * moved the feature consistency check into the encoding circuits * refactored the kernel HLM classes. - move the initialization logic from `_initialize` to `fit` - move all `super` calls to `__init__` - move the `set_up_measurement_operator` and `set_up_qnn` calls to `__init__` of the PQK and only do the initialization logic in `_inititialize` which is related to num_features * Refactor Parameter Handling and Initialization in LayeredEncodingCircuit - Removed global storage of `_x`, `_p`, and `_layered_pqc`; now constructed locally in `_build_layered_pqc` - Updated `set_params` and `get_params` to manage `LayeredPQC`-specific parameters via the `_layered_pqc_params` dictionary - Adjusted `generate_initial_parameters` to build the layered circuit only when needed, ensuring correct `num_params` - Modified `draw` method to build the layered circuit once and update `_num_params` accordingly - Revised `from_string` to store "num_layers" in `_layered_pqc_params` for proper circuit construction * add `num_encoding_slots` Property and a check in `get_circuit` * Refactore RandomEncodingCircuit and RandomLayeredEncodingCircuit generate a new random configuration each time get_circuit is called * Refactor `BaseQNN` and `LowLevelQNNPennyLane` for improved feature handling and initialization * move ´_initilize_derivative´ to `evaluate` in `LowLevelQNNQiskit` * refactore the `Layer` to apply the operations in the `Layer` correctly * moved the `_initialize_parameters` logic into the `fit` method * add the `num_encoding_slots` property to the `LayeredEncodingCircuit` * removed reference to the `num_features` property in `QFI` * refactore `PrunedEncodingCircuit` - simplified pruning logic - removed references to `num_features` property - calculate `num_encoding_slots` depending on the pruned encoding_slots * add tests for `PrunedEncodingCircuit` * refactore `ComposedEncodingCircuit`: - removed the `set_num_features` method - removed all references to the `num_features` property - pass the feature vector in `get_circuit` to `ec1` and `ec2` * add `num_encoding_slots` property to `ComposedEncodingCircuit` * override the `draw` method in the `ComposedEncodingCircuit` to enable correct drawing if a `LayeredEncodingCircuit` gets combined * Fix: remove falsly passed argument `num_features` in `QCNNEncodingCircuit` * refactore examples to use the correct `EncodingCircuit` signature * adjust docstrings to align with method and class signatures * adjust user guids to align with new method und class signatures * fix `FideltityKernel` tests * change `compose` method of `EncodingCircuitBase` to accept also the num_features for both circuits if `concatenate_features` is set to `True` * fix automatic backend selection tests * fix docs * fix qiskit executor example * fix doc check warnings * fix warning in pennylane qnn * update sklearn intersphinx * black * move code from `_generate_initial_parameters` into `_initialize_kernel` * replaced redundant code by method call * removed the grid search example in the docs this is no longer supported since the constructors have changed and the underlying `LayeredPQC` gets not build in the `__init__` directly * inline the collection of the params of the super class * remove `num_features` in the tests * rerun examples * adjust the `draw` method to ensure drawing is allways possible * Improve `_adjust_input` with detailed error messages instead of generic ValueError * remove failing test * move encoding circuit tests to subfolder * black tests * black examples * black * change the `LowLevelQNN` to accept `num_features` to initialize the quantum framework specific circuit in the init of the `LowLevelQNN` * fix tests * fix num_features for pruned encoding circuit * fix get_params for qrc * fix docs --------- Co-authored-by: Dennis Kleinhans <dennis.kleinhans@ipa.fraunhofer.de> Co-authored-by: Moritz Willmann <moritz.willmann@web.de> Co-authored-by: David Kreplin <david.kreplin@ipa.fraunhofer.de> Co-authored-by: Moritz <moritz.willmann@ipa.fraunhofer.de> Co-authored-by: Moritz <44642314+MoritzWillmann@users.noreply.github.com>
* add first draft of qulacs implementation * wip * add parametrized gates with values * fix sign in parametrized gates * functionized parameters working * first draft of mixed parameter expressions * circuit eval working, obs todo * circuit eval working, obs todo * first part of observations owkring * first implementation of parametrized observables * wip: starting on low level qnn with qulacs * draft but not working * fix bug in sorting * first run of pqk is working * added CausalConeSimulator * simple gradients of a single variable are working * more complex terms with single parameters, mixed parameters not working * mixed derivatives working * orbital grad with different observables working * orbital grad with different observables working * first draft of gradients in llqnn working * cleaning and efficiency boost * complete arbitrary operators are workgin * wip * comment out qulacs_execution.py * add statevector evaluation * remove qulacs cp gate * hotfix used parameters for non-parametrized gates * add same fix for two qubit gate * clean statement * allow circuits without features and parameters * move qulacs qnn to folder * black * fix is_parameterized check * wip * black * use kwargs for evaluate functions * rename qualcs to qulacs * use public properties * fix test notebooks * black * add fidelity kernel implementation * black * variance calculation in qulacs now working * refactoring of evaluation code * fix single parameter derivatives for lowlevelqnn * checkin of untracked evaluation_classes.py * use all parameters in symbol tuple * fix sorting * fix in fidelity kernels * add dependency and fix shots * small fixes * reset to pennylane default * add caching for qulacs circuits * black * removed unnecessary examples * reset of examples * changed some examples to qulacs * black * started cleaning * cleaning * cleaning * cleaning of circuit done * cleaning of qulacs_circuit.py * refactored fidelity kernels for qulacs and pennylane * black * adapt LowLevelQNNQulacs to accept num_features * add qulacs to docs * fix QulacsCircuit path in classes.rst --------- Co-authored-by: Moritz <moritz.willmann@ipa.fraunhofer.de> Co-authored-by: Marco <marco.r.roth@gmail.com> Co-authored-by: Moritz <44642314+MoritzWillmann@users.noreply.github.com>
* add qulacs to readme, update schematic * update schematic * remove alpha
* add log loss * fix gradient, add tests * use adam in example * black * doubled classification example * use new black and make eps bigger * add log loss to init * delete old example * add sigmoid to logloss * adjust gradient calculation * add post processing function to lowlevel qnn * move softmax to qnnc * use numerically stable sigmoid and softmax, fix binary case * fix softmax axis * update examples * fix tests * rename to CrossEntropyLoss * fix qnnc tests * update docstring * adapt numpy version for examples * adapt lowest dependencies * add source in tests.yaml * fix numpy requirement for examples * black tests * add post_processing to LowLevelQNNQulacs --------- Co-authored-by: David Kreplin <david.kreplin@ipa.fraunhofer.de> Co-authored-by: mcr <marco.r.roth@gmail.com>
* Add option for estimator to inherit only from BaseEstimatorV2 * Update executor.py * allow None backends * remove errors --------- Co-authored-by: Moritz <moritz.willmann@ipa.fraunhofer.de> Co-authored-by: Moritz <44642314+MoritzWillmann@users.noreply.github.com>
…loaded (#339) * add `ExecutorPickler` and `ExecutorUnpickler` to pickle models without the executor and unpickle them while injecting an provided executor * add `SerializableModelMixin` which uses the `ExecutorPickler` and `ExecutorUnpickler` internally * add tests serialization tests for all models and for the `ExecutorPickler` and `ExecutorUnpickler` itself * Use contextmanager for safe and clean file handling in serialization * change executor identifier to unique identifier with namespace * remove `:ref:` in docs * change imports to relative imports * add single threaded execusion in sphinx ci workflow * increase dill dependency * fix in qgpc * black * added symengine dependency * symengine version bump * remove symengine dependency * try out python 3.10 * python 3.10 * version bump of numpy * reset of toml * add pickler for SparsePauliOp * reset workflow for test * update of dill * added framework change to serialization * check j1 flag * rename of pickler * added tests for different frameworks * black * fix qulacs pickling * black --------- Co-authored-by: Dennis Kleinhans <dennis.kleinhans@ipa.fraunhofer.de> Co-authored-by: David Kreplin <david.kreplin@ipa.fraunhofer.de> Co-authored-by: Moritz <44642314+MoritzWillmann@users.noreply.github.com> Co-authored-by: David Kreplin <106071697+David-Kreplin@users.noreply.github.com>
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.
No description provided.