lazyqml 3.0.6__py2.py3-none-any.whl → 3.1.0__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
lazyqml/__init__.py CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  __author__ = """Diego García Vega, Fernando Álvaro Plou Llorente, Alejandro Leal Castaño"""
4
4
  __email__ = "garciavdiego@uniovi.es, ploufernando@uniovi.es, lealcalejandro@uniovi.es"
5
- __version__ = "3.0.6"
5
+ __version__ = "3.1.0"
@@ -0,0 +1,130 @@
1
+ Metadata-Version: 2.1
2
+ Name: lazyqml
3
+ Version: 3.1.0
4
+ Summary: LazyQML benchmarking utility to test quantum machine learning models.
5
+ Author-email: QHPC Group <qhpcgroup@gmail.com>
6
+ License: MIT License
7
+ Project-URL: Homepage, https://github.com/QHPC-SP-Research-Lab/LazyQML
8
+ Keywords: lazyqml
9
+ Classifier: Intended Audience :: Science/Research
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Natural Language :: English
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Requires-Python: >=3.9
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ License-File: LICENSE copy
17
+ License-File: AUTHORS.rst
18
+ Requires-Dist: wheel
19
+ Requires-Dist: tabulate
20
+ Requires-Dist: torch
21
+ Requires-Dist: torchaudio
22
+ Requires-Dist: torchvision
23
+ Requires-Dist: scipy
24
+ Requires-Dist: scikit-learn
25
+ Requires-Dist: PennyLane
26
+ Requires-Dist: PennyLane_Lightning
27
+ Requires-Dist: PennyLane_Lightning_GPU
28
+ Requires-Dist: custatevec_cu12
29
+ Requires-Dist: ucimlrepo
30
+ Requires-Dist: pydantic
31
+ Requires-Dist: psutil
32
+ Requires-Dist: pandas
33
+ Requires-Dist: joblib
34
+ Requires-Dist: gputil
35
+ Provides-Extra: all
36
+ Requires-Dist: lazyqml[extra]; extra == "all"
37
+ Provides-Extra: extra
38
+ Requires-Dist: pandas; extra == "extra"
39
+
40
+ ![logo](./docs/logo.jpg)
41
+ ---
42
+ [![Pypi](https://img.shields.io/badge/pypi-%23ececec.svg?style=for-the-badge&logo=pypi&logoColor=1f73b7)](https://pypi.python.org/pypi/lazyqml)
43
+ ![GitHub Actions](https://img.shields.io/badge/github%20actions-%232671E5.svg?style=for-the-badge&logo=githubactions&logoColor=white)
44
+ ![NumPy](https://img.shields.io/badge/numpy-%23013243.svg?style=for-the-badge&logo=numpy&logoColor=white)
45
+ ![Pandas](https://img.shields.io/badge/pandas-%23150458.svg?style=for-the-badge&logo=pandas&logoColor=white)
46
+ ![PyTorch](https://img.shields.io/badge/PyTorch-%23EE4C2C.svg?style=for-the-badge&logo=PyTorch&logoColor=white)
47
+ ![scikit-learn](https://img.shields.io/badge/scikit--learn-%23F7931E.svg?style=for-the-badge&logo=scikit-learn&logoColor=white)
48
+ ![nVIDIA](https://img.shields.io/badge/cuda-000000.svg?style=for-the-badge&logo=nVIDIA&logoColor=green)
49
+ ![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black)
50
+
51
+
52
+
53
+ LazyQML is a Python library designed to streamline, automate, and accelerate experimentation with Quantum Machine Learning (QML) architectures, right on classical computers.
54
+
55
+ With LazyQML, you can:
56
+ - 🛠️ Build, test, and benchmark QML models with minimal effort.
57
+
58
+ - ⚡ Compare different QML architectures, hyperparameters seamlessly.
59
+
60
+ - 🧠 Gather knowledge about the most suitable architecture for your problem.
61
+
62
+ ## ✨ Why LazyQML?
63
+
64
+ - Rapid Prototyping: Experiment with different QML models using just a few lines of code.
65
+
66
+ - Automated Benchmarking: Evaluate performance and trade-offs across architectures effortlessly.
67
+
68
+ - Flexible & Modular: From basic quantum circuits to hybrid quantum-classical models—LazyQML has you covered.
69
+
70
+ ## Documentation
71
+ For detailed usage instructions, API reference, and code examples, please refer to the official LazyQML documentation.
72
+
73
+ ## Requirements
74
+
75
+ - Python >= 3.10
76
+
77
+ > [!CAUTION]
78
+ > This library is only supported by Linux Systems. It doesn't support Windows nor MacOS.
79
+
80
+
81
+ ## Installation
82
+ To install lazyqml, run this command in your terminal:
83
+
84
+ ```
85
+ pip install lazyqml
86
+ ```
87
+
88
+ This is the preferred method to install lazyqml, as it will always install the most recent stable release.
89
+
90
+ If you don't have [pip](https://pip.pypa.io) installed, this [Python installation guide](http://docs.python-guide.org/en/latest/starting/installation/) can guide you through the process.
91
+
92
+ ### From sources
93
+
94
+ To install lazyqml from sources, run this command in your terminal:
95
+
96
+ ```
97
+ pip install git+https://github.com/QHPC-SP-Research-Lab/LazyQML
98
+ ```
99
+ ## Example
100
+
101
+ ```python
102
+ from sklearn.datasets import load_iris
103
+ from lazyqml.lazyqml import *
104
+
105
+ # Load data
106
+ data = load_iris()
107
+ X = data.data
108
+ y = data.target
109
+
110
+ classifier = QuantumClassifier(nqubits={4}, classifiers={Model.QNN, Model.QSVM}, epochs=10)
111
+
112
+ # Fit and predict
113
+ classifier.fit(X=X, y=y, test_size=0.4)
114
+ ```
115
+
116
+ ## Quantum and High Performance Computing (QHPC) - University of Oviedo
117
+ - José Ranilla Pastor - ranilla@uniovi.es
118
+ - Elías Fernández Combarro - efernandezca@uniovi.es
119
+ - Diego García Vega - diegogarciavega@gmail.com
120
+ - Fernando Álvaro Plou Llorente - ploufernando@uniovi.es
121
+ - Alejandro Leal Castaño - lealcalejandro@uniovi.es
122
+ - Group - https://qhpc.uniovi.es
123
+
124
+ ## Citing
125
+ If you used LazyQML in your work, please cite:
126
+ - García-Vega, D., Plou Llorente, F., Leal Castaño, A., Combarro, E.F., Ranilla, J.: Lazyqml: A python library to benchmark quantum machine learning models. In: 30th European Conference on Parallel and Distributed Processing (2024)
127
+
128
+ ## License
129
+ - Free software: MIT License
130
+
@@ -1,4 +1,4 @@
1
- lazyqml/__init__.py,sha256=ltsP0C7mVIqRFCEuamVFDKwS-W4MYUslenefSJGYqK0,242
1
+ lazyqml/__init__.py,sha256=M5rTFF_L-2w-CYVAK1ACQXECNM3EvF2WCorMhl4jd64,242
2
2
  lazyqml/lazyqml.py,sha256=zrKvufHWroOnHJeeytKqrZ3BsWliFRvwVzdcsV8I-cE,14397
3
3
  lazyqml/Factories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  lazyqml/Factories/Circuits/AmplitudeEmbedding.py,sha256=alkSF082NuQk_FkBfCh3fMPu_d6q7kBIfyhYBztlhYo,646
@@ -30,11 +30,11 @@ lazyqml/Interfaces/iModel.py,sha256=W_yYoZd7hS8ZKGvNAyl-waJ6f7F0kIM6zrg9WqyPt_I,
30
30
  lazyqml/Interfaces/iPreprocessing.py,sha256=O9f2tCnWTbjkHi4_XKaPWsE2SWKsdI1pj2lCyBWih9o,255
31
31
  lazyqml/Utils/Utils.py,sha256=JMmN1ilzNXTnhA5PZaMZvEVbtnKFYW50xUejWDLeAfM,10034
32
32
  lazyqml/Utils/Validator.py,sha256=6Ox2A5WAV5GYPuFfB873mpEqCHSmhhSwFV_LGI-ZJ5s,4622
33
- lazyqml-3.0.6.dist-info/AUTHORS.rst,sha256=Y_bDRslOAz5wcAYrTAnjDlmlW-51LfVF0Xwf09TbW3Y,245
34
- lazyqml-3.0.6.dist-info/LICENSE,sha256=42X2ZTCkjjhUks41WOjPmwX8sbCfgf431zzdCne6gqE,1079
35
- lazyqml-3.0.6.dist-info/LICENSE copy,sha256=y9EYvUN_l9ZWDuiVcxHE1NWbfy_HR9Z-8G19719ynbQ,1077
36
- lazyqml-3.0.6.dist-info/METADATA,sha256=eDor9rmf4dwP5WZtCdTkhkYXGlSfw-90WeOmdaHF8vQ,10107
37
- lazyqml-3.0.6.dist-info/WHEEL,sha256=pxeNX5JdtCe58PUSYP9upmc7jdRPgvT0Gm9kb1SHlVw,109
38
- lazyqml-3.0.6.dist-info/entry_points.txt,sha256=I0WR08yVIeXjSa8XBSGZ9SsZtM8uMvKwZOdU1qQajao,45
39
- lazyqml-3.0.6.dist-info/top_level.txt,sha256=x2ffpytT-NeXmC7YaZLSQNMLK0pLfUiRmGOqwNbyjZE,8
40
- lazyqml-3.0.6.dist-info/RECORD,,
33
+ lazyqml-3.1.0.dist-info/AUTHORS.rst,sha256=Y_bDRslOAz5wcAYrTAnjDlmlW-51LfVF0Xwf09TbW3Y,245
34
+ lazyqml-3.1.0.dist-info/LICENSE,sha256=42X2ZTCkjjhUks41WOjPmwX8sbCfgf431zzdCne6gqE,1079
35
+ lazyqml-3.1.0.dist-info/LICENSE copy,sha256=y9EYvUN_l9ZWDuiVcxHE1NWbfy_HR9Z-8G19719ynbQ,1077
36
+ lazyqml-3.1.0.dist-info/METADATA,sha256=95H9LbZCtRGGCgx6ILQ5nD1RyadoLBWsFoqXPBLvMlc,4747
37
+ lazyqml-3.1.0.dist-info/WHEEL,sha256=pxeNX5JdtCe58PUSYP9upmc7jdRPgvT0Gm9kb1SHlVw,109
38
+ lazyqml-3.1.0.dist-info/entry_points.txt,sha256=I0WR08yVIeXjSa8XBSGZ9SsZtM8uMvKwZOdU1qQajao,45
39
+ lazyqml-3.1.0.dist-info/top_level.txt,sha256=x2ffpytT-NeXmC7YaZLSQNMLK0pLfUiRmGOqwNbyjZE,8
40
+ lazyqml-3.1.0.dist-info/RECORD,,
@@ -1,255 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: lazyqml
3
- Version: 3.0.6
4
- Summary: LazyQML benchmarking utility to test quantum machine learning models.
5
- Author-email: QHPC Group <qhpcgroup@gmail.com>
6
- License: MIT License
7
- Project-URL: Homepage, https://github.com/QHPC-SP-Research-Lab/LazyQML
8
- Keywords: lazyqml
9
- Classifier: Intended Audience :: Science/Research
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Natural Language :: English
12
- Classifier: Programming Language :: Python :: 3.10
13
- Requires-Python: >=3.9
14
- Description-Content-Type: text/markdown
15
- License-File: LICENSE
16
- License-File: LICENSE copy
17
- License-File: AUTHORS.rst
18
- Requires-Dist: wheel
19
- Requires-Dist: tabulate
20
- Requires-Dist: torch
21
- Requires-Dist: torchaudio
22
- Requires-Dist: torchvision
23
- Requires-Dist: scipy
24
- Requires-Dist: scikit-learn
25
- Requires-Dist: PennyLane
26
- Requires-Dist: PennyLane_Lightning
27
- Requires-Dist: PennyLane_Lightning_GPU
28
- Requires-Dist: custatevec_cu12
29
- Requires-Dist: ucimlrepo
30
- Requires-Dist: pydantic
31
- Requires-Dist: psutil
32
- Requires-Dist: pandas
33
- Requires-Dist: joblib
34
- Requires-Dist: gputil
35
- Provides-Extra: all
36
- Requires-Dist: lazyqml[extra]; extra == "all"
37
- Provides-Extra: extra
38
- Requires-Dist: pandas; extra == "extra"
39
-
40
- # LazyQML
41
-
42
-
43
- [![image](https://img.shields.io/badge/pypi-%23ececec.svg?style=for-the-badge&logo=pypi&logoColor=1f73b7)](https://pypi.python.org/pypi/lazyqml)
44
- ![GitHub Actions](https://img.shields.io/badge/github%20actions-%232671E5.svg?style=for-the-badge&logo=githubactions&logoColor=white)
45
- ![NumPy](https://img.shields.io/badge/numpy-%23013243.svg?style=for-the-badge&logo=numpy&logoColor=white)
46
- ![Pandas](https://img.shields.io/badge/pandas-%23150458.svg?style=for-the-badge&logo=pandas&logoColor=white)
47
- ![PyTorch](https://img.shields.io/badge/PyTorch-%23EE4C2C.svg?style=for-the-badge&logo=PyTorch&logoColor=white)
48
- ![scikit-learn](https://img.shields.io/badge/scikit--learn-%23F7931E.svg?style=for-the-badge&logo=scikit-learn&logoColor=white)
49
- ![nVIDIA](https://img.shields.io/badge/cuda-000000.svg?style=for-the-badge&logo=nVIDIA&logoColor=green)
50
- <img src="https://assets.cloud.pennylane.ai/pennylane_website/generic/logo.svg" alt="Pennylane Logo" style="background-color: white; padding: 2px;" />
51
- ![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black)
52
-
53
- <!-- ![Pennylane](https://assets.cloud.pennylane.ai/pennylane_website/generic/logo.svg) -->
54
-
55
- pLazyQML, a software package designed to accelerate, automate, and streamline experimentation with quantum machine learning models on classical computers. pLazyQML reduces the complexity and time required for developing and testing quantum-enhanced machine learning models.
56
-
57
- ## Installation
58
- ```bash
59
- $ pip install lazyqml --upgrade
60
- ```
61
- ## Usage
62
- ```python
63
- from sklearn.datasets import load_iris
64
- from lazyqml.lazyqml import *
65
-
66
- # Load data
67
- data = load_iris()
68
- X = data.data
69
- y = data.target
70
-
71
- classifier = QuantumClassifier(nqubits={4}, classifiers={Model.QNN, Model.QSVM}, epochs=10)
72
-
73
- # Fit and predict
74
- classifier.fit(X=X, y=y, test_size=0.4)
75
- ```
76
- ### Output
77
- | Qubits | Model | Embedding | Ansatz | Time taken | Accuracy | Balanced Accuracy | F1 Score |
78
- |---------:|:-----------|:--------------|:---------------------------|-------------:|-----------:|--------------------:|-----------:|
79
- | 4 | Model.QSVM | Embedding.RZ | | 18.2478 | 0.966667 | 0.966667 | 0.966583 |
80
- | 4 | Model.QSVM | Embedding.RY | | 13.8088 | 0.966667 | 0.966667 | 0.966583 |
81
- | 4 | Model.QSVM | Embedding.RX | | 13.7079 | 0.966667 | 0.966667 | 0.966583 |
82
- | 4 | Model.QNN | Embedding.RX | Ansatzs.HARDWARE_EFFICIENT | 11.1699 | 0.933333 | 0.933333 | 0.932896 |
83
- | 4 | Model.QNN | Embedding.RZ | Ansatzs.HARDWARE_EFFICIENT | 11.7565 | 0.9 | 0.9 | 0.899206 |
84
- | 4 | Model.QNN | Embedding.RY | Ansatzs.HARDWARE_EFFICIENT | 11.8614 | 0.9 | 0.9 | 0.899948 |
85
-
86
-
87
- ## License & Compatibility
88
- - Free software: MIT License
89
- - This Python package is only compatible with Linux systems.
90
- - Hardware acceleration is only enabled using CUDA-compatible devices.
91
- ## Quantum and High Performance Computing (QHPC) - University of Oviedo
92
- - José Ranilla Pastor - ranilla@uniovi.es
93
- - Elías Fernández Combarro - efernandezca@uniovi.es
94
- - Diego García Vega - diegogarciavega@gmail.com
95
- - Fernando Álvaro Plou Llorente - ploufernando@uniovi.es
96
- - Alejandro Leal Castaño - lealcalejandro@uniovi.es
97
- - Group - https://qhpc.uniovi.es
98
-
99
- ## QuantumClassifier Parameters:
100
- #### Core Parameters:
101
- - **`nqubits`**: `Set[int]`
102
- - Description: Set of qubit indices, where each value must be greater than 0.
103
- - Validation: Ensures that all elements are integers > 0.
104
-
105
- - **`randomstate`**: `int`
106
- - Description: Seed value for random number generation.
107
- - Default: `1234`
108
-
109
- - **`predictions`**: `bool`
110
- - Description: Flag to determine if predictions are enabled.
111
- - Default: `False`
112
-
113
- #### Model Structure Parameters:
114
- - **`numPredictors`**: `int`
115
- - Description: Number of predictors used in the QNN with bagging.
116
- - Constraints: Must be greater than 0.
117
- - Default: `10`
118
-
119
- - **`numLayers`**: `int`
120
- - Description: Number of layers in the Quantum Neural Networks.
121
- - Constraints: Must be greater than 0.
122
- - Default: `5`
123
-
124
- #### Set-Based Configuration Parameters:
125
- - **`classifiers`**: `Set[Model]`
126
- - Description: Set of classifier models.
127
- - Constraints: Must contain at least one classifier.
128
- - Default: `{Model.ALL}`
129
- - Options: `{Model.QNN, Model.QSVM, Model.QNN_BAG}`
130
-
131
- - **`ansatzs`**: `Set[Ansatzs]`
132
- - Description: Set of quantum ansatz configurations.
133
- - Constraints: Must contain at least one ansatz.
134
- - Default: `{Ansatzs.ALL}`
135
- - Options: `{Ansatzs.RX, Ansatzs.RZ, Ansatzs.RY, Ansatzs.ZZ, Ansatzs.AMP}`
136
-
137
- - **`embeddings`**: `Set[Embedding]`
138
- - Description: Set of embedding strategies.
139
- - Constraints: Must contain at least one embedding.
140
- - Default: `{Embedding.ALL}`
141
- - Options: `{Embedding.HCZRX, Embedding.TREE_TENSOR, Embedding.TWO_LOCAL, Embedding.HARDWARE_EFFICENT}`
142
-
143
- - **`features`**: `Set[float]`
144
- - Description: Set of feature values (must be between 0 and 1).
145
- - Constraints: Values > 0 and <= 1.
146
- - Default: `{0.3, 0.5, 0.8}`
147
-
148
- #### Training Parameters:
149
- - **`learningRate`**: `float`
150
- - Description: Learning rate for optimization.
151
- - Constraints: Must be greater than 0.
152
- - Default: `0.01`
153
-
154
- - **`epochs`**: `int`
155
- - Description: Number of training epochs.
156
- - Constraints: Must be greater than 0.
157
- - Default: `100`
158
-
159
- - **`batchSize`**: `int`
160
- - Description: Size of each batch during training.
161
- - Constraints: Must be greater than 0.
162
- - Default: `8`
163
-
164
- #### Threshold and Sampling:
165
- - **`threshold`**: `int`
166
- - Description: Decision threshold for parallelization, if the model is bigger than this threshold it will use GPU.
167
- - Constraints: Must be greater than 0.
168
- - Default: `22`
169
-
170
- - **`maxSamples`**: `float`
171
- - Description: Maximum proportion of samples to be used from the dataset characteristics.
172
- - Constraints: Between 0 and 1.
173
- - Default: `1.0`
174
-
175
- #### Logging and Metrics:
176
- - **`verbose`**: `bool`
177
- - Description: Flag for detailed output during training.
178
- - Default: `False`
179
-
180
- - **`customMetric`**: `Optional[Callable]`
181
- - Description: User-defined metric function for evaluation.
182
- - Validation:
183
- - Function must accept `y_true` and `y_pred` as the first two arguments.
184
- - Must return a scalar value (int or float).
185
- - Function execution is validated with dummy arguments.
186
- - Default: `None`
187
-
188
- #### Custom Preprocessors:
189
- - **`customImputerNum`**: `Optional[Any]`
190
- - Description: Custom numeric data imputer.
191
- - Validation:
192
- - Must be an object with `fit`, `transform`, and optionally `fit_transform` methods.
193
- - Validated with dummy data.
194
- - Default: `None`
195
-
196
- - **`customImputerCat`**: `Optional[Any]`
197
- - Description: Custom categorical data imputer.
198
- - Validation:
199
- - Must be an object with `fit`, `transform`, and optionally `fit_transform` methods.
200
- - Validated with dummy data.
201
- - Default: `None`
202
-
203
- ## Functions:
204
-
205
- ### **`fit`**
206
- ```python
207
- fit(self, X, y, test_size=0.4, showTable=True)
208
- ```
209
- Fits classification algorithms to `X` and `y` using a hold-out approach. Predicts and scores on a test set determined by `test_size`.
210
-
211
- #### Parameters:
212
- - **`X`**: Input features (DataFrame or compatible format).
213
- - **`y`**: Target labels (must be numeric, e.g., via `LabelEncoder` or `OrdinalEncoder`).
214
- - **`test_size`**: Proportion of the dataset to use as the test set. Default is `0.4`.
215
- - **`showTable`**: Display a table with results. Default is `True`.
216
-
217
- #### Behavior:
218
- - Validates the compatibility of input dimensions.
219
- - Automatically applies PCA transformation for incompatible dimensions.
220
- - Requires all categories to be present in training data.
221
-
222
- ### **`repeated_cross_validation`**
223
- ```python
224
- repeated_cross_validation(self, X, y, n_splits=10, n_repeats=5, showTable=True)
225
- ```
226
- Performs repeated cross-validation on the dataset using the specified splits and repeats.
227
-
228
- #### Parameters:
229
- - **`X`**: Input features (DataFrame or compatible format).
230
- - **`y`**: Target labels (must be numeric).
231
- - **`n_splits`**: Number of folds for splitting the dataset. Default is `10`.
232
- - **`n_repeats`**: Number of times cross-validation is repeated. Default is `5`.
233
- - **`showTable`**: Display a table with results. Default is `True`.
234
-
235
- #### Behavior:
236
- - Uses `RepeatedStratifiedKFold` for generating splits.
237
- - Aggregates results from multiple train-test splits.
238
-
239
- ### **`leave_one_out`**
240
- ```python
241
- leave_one_out(self, X, y, showTable=True)
242
- ```
243
- Performs leave-one-out cross-validation on the dataset.
244
-
245
- #### Parameters:
246
- - **`X`**: Input features (DataFrame or compatible format).
247
- - **`y`**: Target labels (must be numeric).
248
- - **`showTable`**: Display a table with results. Default is `True`.
249
-
250
- #### Behavior:
251
- - Uses `LeaveOneOut` for generating train-test splits.
252
- - Evaluates the model on each split and aggregates results.
253
-
254
-
255
-