lazyqml 3.0.4__py2.py3-none-any.whl → 3.0.6__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.
@@ -1,4 +1,4 @@
1
- from Interfaces.iCircuit import Circuit
1
+ from lazyqml.Interfaces.iCircuit import Circuit
2
2
  import pennylane as qml
3
3
 
4
4
  class AmplitudeEmbedding(Circuit):
@@ -1,4 +1,4 @@
1
- from Interfaces.iAnsatz import Ansatz
1
+ from lazyqml.Interfaces.iAnsatz import Ansatz
2
2
  import pennylane as qml
3
3
 
4
4
  class HCzRx(Ansatz):
@@ -1,4 +1,4 @@
1
- from Interfaces.iAnsatz import Ansatz
1
+ from lazyqml.Interfaces.iAnsatz import Ansatz
2
2
  import pennylane as qml
3
3
 
4
4
  class HardwareEfficient(Ansatz):
@@ -1,4 +1,4 @@
1
- from Interfaces.iCircuit import Circuit
1
+ from lazyqml.Interfaces.iCircuit import Circuit
2
2
  import pennylane as qml
3
3
 
4
4
  class RxEmbedding(Circuit):
@@ -1,4 +1,4 @@
1
- from Interfaces.iCircuit import Circuit
1
+ from lazyqml.Interfaces.iCircuit import Circuit
2
2
  import pennylane as qml
3
3
 
4
4
  class RyEmbedding(Circuit):
@@ -1,4 +1,4 @@
1
- from Interfaces.iCircuit import Circuit
1
+ from lazyqml.Interfaces.iCircuit import Circuit
2
2
  import pennylane as qml
3
3
 
4
4
  class RzEmbedding(Circuit):
@@ -1,4 +1,4 @@
1
- from Interfaces.iAnsatz import Ansatz
1
+ from lazyqml.Interfaces.iAnsatz import Ansatz
2
2
  import pennylane as qml
3
3
  import numpy as np
4
4
 
@@ -1,4 +1,4 @@
1
- from Interfaces.iAnsatz import Ansatz
1
+ from lazyqml.Interfaces.iAnsatz import Ansatz
2
2
  import pennylane as qml
3
3
  import numpy as np
4
4
 
@@ -1,4 +1,4 @@
1
- from Interfaces.iCircuit import Circuit
1
+ from lazyqml.Interfaces.iCircuit import Circuit
2
2
  import pennylane as qml
3
3
  import numpy as np
4
4
  from itertools import combinations
@@ -1,16 +1,16 @@
1
1
  # Importing Enums
2
- from Global.globalEnums import Ansatzs, Embedding
2
+ from lazyqml.Global.globalEnums import Ansatzs, Embedding
3
3
  # Importing Ansatzs
4
- from Factories.Circuits.TwoLocal import *
5
- from Factories.Circuits.HardwareEfficient import *
6
- from Factories.Circuits.TreeTensor import *
7
- from Factories.Circuits.HCzRx import *
4
+ from lazyqml.Factories.Circuits.TwoLocal import *
5
+ from lazyqml.Factories.Circuits.HardwareEfficient import *
6
+ from lazyqml.Factories.Circuits.TreeTensor import *
7
+ from lazyqml.Factories.Circuits.HCzRx import *
8
8
  # Importing Embeddings
9
- from Factories.Circuits.RxEmbedding import *
10
- from Factories.Circuits.RyEmbedding import *
11
- from Factories.Circuits.RzEmbedding import *
12
- from Factories.Circuits.ZzEmbedding import *
13
- from Factories.Circuits.AmplitudeEmbedding import *
9
+ from lazyqml.Factories.Circuits.RxEmbedding import *
10
+ from lazyqml.Factories.Circuits.RyEmbedding import *
11
+ from lazyqml.Factories.Circuits.RzEmbedding import *
12
+ from lazyqml.Factories.Circuits.ZzEmbedding import *
13
+ from lazyqml.Factories.Circuits.AmplitudeEmbedding import *
14
14
 
15
15
 
16
16
  class CircuitFactory:
@@ -3,12 +3,9 @@ import torch.nn as nn
3
3
  import torch.optim as optim
4
4
  import pennylane as qml
5
5
  from time import time
6
-
7
- import sys
8
- sys.path.append('/home/diego/LazyQML/lazyqml/')
9
- from Global.globalEnums import *
10
- from Factories.Circuits.fCircuits import CircuitFactory
11
- from Utils.Utils import printer
6
+ from lazyqml.Global.globalEnums import *
7
+ from lazyqml.Factories.Circuits.fCircuits import CircuitFactory
8
+ from lazyqml.Utils.Utils import printer
12
9
 
13
10
 
14
11
  # class HybridQuantumClassicalModel(nn.Module):
@@ -2,12 +2,12 @@ import torch
2
2
  import pennylane as qml
3
3
  from time import time
4
4
  import numpy as np
5
- from Interfaces.iModel import Model
6
- from Interfaces.iAnsatz import Ansatz
7
- from Interfaces.iCircuit import Circuit
8
- from Factories.Circuits.fCircuits import *
9
- from Global.globalEnums import Backend
10
- from Utils.Utils import printer
5
+ from lazyqml.Interfaces.iModel import Model
6
+ from lazyqml.Interfaces.iAnsatz import Ansatz
7
+ from lazyqml.Interfaces.iCircuit import Circuit
8
+ from lazyqml.Factories.Circuits.fCircuits import *
9
+ from lazyqml.Global.globalEnums import Backend
10
+ from lazyqml.Utils.Utils import printer
11
11
  import warnings
12
12
 
13
13
  class QNNBag(Model):
@@ -2,12 +2,12 @@ import torch
2
2
  import pennylane as qml
3
3
  from time import time
4
4
  import numpy as np
5
- from Interfaces.iModel import Model
6
- from Interfaces.iAnsatz import Ansatz
7
- from Interfaces.iCircuit import Circuit
8
- from Factories.Circuits.fCircuits import *
9
- from Global.globalEnums import Backend
10
- from Utils.Utils import printer
5
+ from lazyqml.Interfaces.iModel import Model
6
+ from lazyqml.Interfaces.iAnsatz import Ansatz
7
+ from lazyqml.Interfaces.iCircuit import Circuit
8
+ from lazyqml.Factories.Circuits.fCircuits import *
9
+ from lazyqml.Global.globalEnums import Backend
10
+ from lazyqml.Utils.Utils import printer
11
11
  import warnings
12
12
 
13
13
  class QNNTorch(Model):
@@ -1,4 +1,4 @@
1
- from Interfaces.iModel import Model
1
+ from lazyqml.Interfaces.iModel import Model
2
2
  import numpy as np
3
3
  from sklearn.svm import SVC
4
4
  from sklearn.preprocessing import StandardScaler
@@ -6,8 +6,8 @@ from sklearn.model_selection import train_test_split
6
6
  from sklearn.metrics import accuracy_score, balanced_accuracy_score
7
7
  import pennylane as qml
8
8
  from time import time
9
- from Factories.Circuits.fCircuits import CircuitFactory
10
- from Utils.Utils import printer
9
+ from lazyqml.Factories.Circuits.fCircuits import CircuitFactory
10
+ from lazyqml.Utils.Utils import printer
11
11
 
12
12
  class QSVM(Model):
13
13
  def __init__(self, nqubits, embedding, backend, shots, seed=1234):
@@ -1,7 +1,7 @@
1
- from Factories.Models.QSVM import *
2
- from Factories.Models.QNNBag import *
3
- from Factories.Models.QNNTorch import *
4
- from Global.globalEnums import *
1
+ from lazyqml.Factories.Models.QSVM import *
2
+ from lazyqml.Factories.Models.QNNBag import *
3
+ from lazyqml.Factories.Models.QNNTorch import *
4
+ from lazyqml.Global.globalEnums import *
5
5
 
6
6
  class ModelFactory:
7
7
  def __init__(self) -> None:
@@ -1,5 +1,5 @@
1
1
  from abc import abstractmethod
2
- from Interfaces.iCircuit import Circuit
2
+ from lazyqml.Interfaces.iCircuit import Circuit
3
3
 
4
4
  class Ansatz(Circuit):
5
5
  @abstractmethod
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.4"
5
+ __version__ = "3.0.6"
@@ -0,0 +1,255 @@
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
+
@@ -0,0 +1,40 @@
1
+ lazyqml/__init__.py,sha256=ltsP0C7mVIqRFCEuamVFDKwS-W4MYUslenefSJGYqK0,242
2
+ lazyqml/lazyqml.py,sha256=zrKvufHWroOnHJeeytKqrZ3BsWliFRvwVzdcsV8I-cE,14397
3
+ lazyqml/Factories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ lazyqml/Factories/Circuits/AmplitudeEmbedding.py,sha256=alkSF082NuQk_FkBfCh3fMPu_d6q7kBIfyhYBztlhYo,646
5
+ lazyqml/Factories/Circuits/HCzRx.py,sha256=vJ5R48GBaEyfKayDF6-g-JfRE5eYBJd6dX_nOPqBEX8,1165
6
+ lazyqml/Factories/Circuits/HardwareEfficient.py,sha256=5fsPtLnw24Vdke_OWy-uBdCGoW7q4Af1qRvuEVhC-jc,1812
7
+ lazyqml/Factories/Circuits/RxEmbedding.py,sha256=m47VHQG4gurVD5gcFJBZH5DlfZ1EtDK4rWyBjnqv2k8,631
8
+ lazyqml/Factories/Circuits/RyEmbedding.py,sha256=EJ3Dc9PoKsE2oPjBiLofp_jk8bLl10IJJoq1vbHeEeM,631
9
+ lazyqml/Factories/Circuits/RzEmbedding.py,sha256=fKL5Mi7JNWsy9qr6PAOS3FFa97m7XUPtUZ2sWHcHYJA,699
10
+ lazyqml/Factories/Circuits/TreeTensor.py,sha256=FRgLe9VariRKUYiNXqiKp1fxdSEV1AvgFNwAFYyAPlU,1298
11
+ lazyqml/Factories/Circuits/TwoLocal.py,sha256=9TVqLlGTmcaVz92vfJCiTHgjJrcvQoT-9wZJL2O3HEw,970
12
+ lazyqml/Factories/Circuits/ZzEmbedding.py,sha256=x3jRAxJcd1uvacvIYyDL39TE-jNVeHhSTUUIREh4XZE,1070
13
+ lazyqml/Factories/Circuits/fCircuits.py,sha256=s7t_o5ieKiq8t34qCZhPw_Hww6GmLBwM8Lbo74yrC38,1740
14
+ lazyqml/Factories/Dispatchers/Dispatcher.py,sha256=Qqh1WNvysBH1z9JTyWEWmhOu9uAxPuB4dwzmv0ImH-0,14486
15
+ lazyqml/Factories/Models/Hybrid.py,sha256=_hzxLQiLkG-shGmNAXrebQoLKJ3HrAyUZUX2g9C-rhw,17704
16
+ lazyqml/Factories/Models/QNNBag.py,sha256=OUaZkEJ97WieFxHYx5lk-AixQGEmI7qp2oFJ_xS_Qms,6608
17
+ lazyqml/Factories/Models/QNNTorch.py,sha256=IyQJp0YiPpOA-5VCwUCsiYP89m-eTEuPf2MLdZu8clc,6636
18
+ lazyqml/Factories/Models/QSVM.py,sha256=X3NUqZTck-rJwg24zqfhqy6xAU5ejPqNYRVgwlO_qws,3249
19
+ lazyqml/Factories/Models/_QNNPennylane.py,sha256=cn7lSZ0tEps61xleIeI7oWyGxeotiwQc74dYVFe-rIc,3380
20
+ lazyqml/Factories/Models/fModels.py,sha256=0WMazRhDrf9y-DUovZmFDtd-26WXK71MvYq31wav7oE,1374
21
+ lazyqml/Factories/Preprocessing/Pca.py,sha256=4TmNOMw6XrZ68qqDiUsB1eQ9BHLKiD1sanfI-dGqWjE,971
22
+ lazyqml/Factories/Preprocessing/Sanitizer.py,sha256=8EoAfVZAGVpLD529vwqGTxAli7miPxW02pXb2IH5DE0,1117
23
+ lazyqml/Factories/Preprocessing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
+ lazyqml/Factories/Preprocessing/fPreprocessing.py,sha256=LPA4r0AFk67YbZVSAZTwTzC6oZ8P4tfpuDO8psnsTKQ,842
25
+ lazyqml/Global/globalEnums.py,sha256=Qc4Xep-LnubsxUvb8ZW5h-XZVjLRFXWfv040NXIt4HY,962
26
+ lazyqml/Interfaces/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
+ lazyqml/Interfaces/iAnsatz.py,sha256=BzXiM9Ed4iav6jq0TrNRxOTOorPQazZA9a07JsdKbW0,164
28
+ lazyqml/Interfaces/iCircuit.py,sha256=L-GbUQmJ2s0uc5AjJj4zIruWP7XSycpG-C8xI4_wnxc,115
29
+ lazyqml/Interfaces/iModel.py,sha256=W_yYoZd7hS8ZKGvNAyl-waJ6f7F0kIM6zrg9WqyPt_I,176
30
+ lazyqml/Interfaces/iPreprocessing.py,sha256=O9f2tCnWTbjkHi4_XKaPWsE2SWKsdI1pj2lCyBWih9o,255
31
+ lazyqml/Utils/Utils.py,sha256=JMmN1ilzNXTnhA5PZaMZvEVbtnKFYW50xUejWDLeAfM,10034
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,,
@@ -1,122 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: lazyqml
3
- Version: 3.0.4
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
- ## Usage
57
- ```python
58
- from lazyqml.lazyqml import QuantumClassifier
59
- from lazyqml.Global.globalEnums import *
60
- from sklearn.datasets import load_breast_cancer, load_iris
61
- from sklearn.model_selection import train_test_split
62
- # Load data
63
- data = load_iris()
64
- X = data.data
65
- y = data.target
66
-
67
- # Split data
68
- X_train, X_test, y_train, y_test = train_test_split(X, y,test_size=.3,random_state =123)
69
-
70
- # Initialize L azyClass ifier
71
- classifier = QuantumClassifier(nqubits={4,8,16},verbose=True,sequential=False,backend=Backend.lightningQubit)
72
-
73
- # Fit and predict
74
- classifier.fit(X_train=X_train,y_train=y_train,X_test=X_test,y_test=y_test)
75
- ```
76
-
77
- ## License & Compatibility
78
- - Free software: MIT License
79
- - This Python package is only compatible with Linux systems.
80
- - Hardware acceleration is only enabled using CUDA-compatible devices.
81
- ## Quantum and High Performance Computing (QHPC) - University of Oviedo
82
- - José Ranilla Pastor - ranilla@uniovi.es
83
- - Elías Fernández Combarro - efernandezca@uniovi.es
84
- - Diego García Vega - diegogarciavega@gmail.com
85
- - Fernando Álvaro Plou Llorente - ploufernando@uniovi.es
86
- - Alejandro Leal Castaño - lealcalejandro@uniovi.es
87
- - Group - https://qhpc.uniovi.es
88
-
89
- ## Parameters:
90
- - **verbose** _bool, optional (default=False)_: If set to True, detailed messages about the training process will be displayed, helping users to monitor the progress and debug if necessary.
91
- - **customMetric** _function, optional (default=None)_: A custom evaluation function provided by the user to evaluate the models. This allows the user to define their own metrics tailored to specific requirements.
92
- - **customImputerNum** _function, optional (default=None)_: A custom function provided by the user to handle the imputation of missing numeric data. This provides flexibility in how missing values are treated in the dataset.
93
- - **customImputerCat** _function, optional (default=None)_: A custom function provided by the user to handle the imputation of missing categorical data, allowing users to apply their own strategies for handling missing categorical values.
94
- - **prediction** _bool, optional (default=False)_: If set to True, the predictions made by all the models will be returned as a pandas DataFrame for easy comparison and analysis of different models’ outputs.
95
- - **classifiers** _set of enums, optional (default={Model.ALL})_: A set specifying which classifiers to train. Options include `{Model.ALL, Model.QSVM, Model.QNN, Model.QNN_BAG}`, enabling the user to select specific quantum classifiers or train all available ones.
96
- - **embeddings** _set of enums, optional (default={Embedding.ALL})_: A set specifying which embeddings to use for training. Options include `{Embedding.ALL, Embedding.RX, Embedding.RZ, Embedding.RY, Embedding.ZZ, Embedding.AMP}`, allowing the user to choose specific data encodings.
97
- - **ansatzs** _set of enums, optional (default={Ansatzs.ALL})_: A set specifying which quantum circuit ansatzes to use. Options include `{Ansatzs.ALL, Ansatzs.HCZRX, Ansatzs.TREE_TENSOR, Ansatzs.TWO_LOCAL, Ansatzs.HARDWARE_EFFICIENT}`, giving users the ability to experiment with different quantum circuit structures.
98
- - **randomState** _int, optional (default=1234)_: An integer seed used to ensure the repeatability of experiments, making the results consistent across different runs.
99
- - **nqubits** _int, optional (default=8)_: Specifies the number of qubits for the quantum circuits used by the models. This parameter controls the size of the quantum circuits.
100
- - **numLayers** _int, optional (default=5)_: Indicates the number of layers in the Quantum Neural Network (QNN) models, affecting the depth and potentially the performance of the neural networks.
101
- - **numPredictors** _int, optional (default=10)_: Specifies the number of different predictors used in Quantum Neural Networks with Bagging (QNN_Bag). This parameter controls the ensemble size in bagging models.
102
- - **maxSamples** _float, optional (default=1.0)_: A floating point number between 0 and 1.0 indicating the fraction of the dataset to be used for each Quantum Neural Network with Bagging (QNN_Bag).
103
- - **maxFeatures** _float, optional (default=0.8)_: A floating point number between 0 and 1.0 indicating the fraction of the dataset features to be used for each Quantum Neural Network with Bagging (QNN_Bag).
104
- - **runs** _int, optional (default=1)_: The number of training runs for the Quantum Neural Network (QNN) models. This parameter determines how many times the model is trained and evaluated.
105
- - **learningRate** _float, optional (default=0.01)_: The learning rate for the gradient descent optimization process used in all Quantum Neural Networks (QNNs). This controls how much the model's weights are updated during each training step.
106
- - **epochs** _int, optional (default=100)_: The number of complete passes through the dataset during model fitting. More epochs can allow the model to converge more accurately, though may increase computation time.
107
- - **backend** _enum, optional (default=Backend.lightningQubit)_: This field controls the acceleration used in the quantum simulator. Supported values are `{Backend.lightningQubit, Backend.lightningGPU, Backend.defaultQubit}`, specifying which backend to use for quantum circuit simulation.
108
- - **threshold** _int, optional (default=22)_: Integer value used to delimit from which number of qubits the internal operations of the models start to be parallelized. This helps optimize performance for larger quantum circuits.
109
- - **cores** _int, optional (default=-1)_: Number of processes to be created by the dispatcher to run the selected models. Each process will be allocated as many CPU cores as possible for parallel execution.
110
- ## Functions:
111
- - **fit** _(X, y, test\_size, showTable=True)_: Fit Classification algorithms to X and y using hold-out, predict and score on test set (test_size).
112
- If the dimensions of the training vectors are not compatible with the different models, a
113
- PCA transformation will be used in order to reduce the dimensionality to a compatible space.
114
- All categories must be in the training data if there are new categories in the test date the
115
- function will not work. The objective variable must be in a numerical form like LabelEncoder or
116
- OrdinalEncoder. Onehot or strings won't work.
117
- - **repeated_cross_validation** _(X, y, n_splits=5, n_repeats=10, showTable=True)_: Perform repeated cross-validation on the given dataset and model.This method splits the dataset into multiple train-test splits using RepeatedStratifiedKFold,
118
- fits the model on the training set, evaluates it on the validation set, and aggregates the results.
119
-
120
- - **leave_one_out** _(X, y, showTable=True)_: Perform leave-one-out cross-validation on the given dataset and model. This method splits the dataset into multiple train-test splits using LeaveOneOut,
121
- fits the model on the training set, evaluates it on the validation set, and aggregates the results.
122
-
@@ -1,40 +0,0 @@
1
- lazyqml/__init__.py,sha256=7hNBcf4kFHPCWtJXNhP2UvVpifpD_YJ1Z6bv6NCYuWg,242
2
- lazyqml/lazyqml.py,sha256=zrKvufHWroOnHJeeytKqrZ3BsWliFRvwVzdcsV8I-cE,14397
3
- lazyqml/Factories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- lazyqml/Factories/Circuits/AmplitudeEmbedding.py,sha256=P49rPc9aEK558yx8WYyzRGWfLuLCoJr_OjdOvWqDTbo,638
5
- lazyqml/Factories/Circuits/HCzRx.py,sha256=VQ4bCJ7_iAJ5d2mSRbpLqbEV3U8azinvdX2oZnXoA1M,1157
6
- lazyqml/Factories/Circuits/HardwareEfficient.py,sha256=f8qNl7fGcvIOUKVbwQ2Uey_4J7W8QZAqAE5auqU4huo,1804
7
- lazyqml/Factories/Circuits/RxEmbedding.py,sha256=aVT6nuqJNJXUCGRMCf6gh3Wp3x4ZmPfd6b7XrqrqV50,623
8
- lazyqml/Factories/Circuits/RyEmbedding.py,sha256=rJ4NUSHNaY-TO1d9RVoDBY9Yv56-1xIA6I5nUyosdK0,623
9
- lazyqml/Factories/Circuits/RzEmbedding.py,sha256=6RoWWA4DTrObGRsy7ffR2a9vrK7cPBJE2uAGphrY3yc,691
10
- lazyqml/Factories/Circuits/TreeTensor.py,sha256=IXZrbzfGS6TDt-EAyCUJ1yYluaie2nrZyEmZnOUedL0,1290
11
- lazyqml/Factories/Circuits/TwoLocal.py,sha256=s73of6_vossAn5VLKjIQw0AaiHYTi0jh9cpmLBLg-8U,962
12
- lazyqml/Factories/Circuits/ZzEmbedding.py,sha256=irIV05Nn95NbTxb9OYt0qR2mXxPDfKRhNTw-1a-lss8,1062
13
- lazyqml/Factories/Circuits/fCircuits.py,sha256=YzEQiO-4XKJ_XoRU9CHybnI5Stqh7bmeZCeMVLs4kKg,1660
14
- lazyqml/Factories/Dispatchers/Dispatcher.py,sha256=Qqh1WNvysBH1z9JTyWEWmhOu9uAxPuB4dwzmv0ImH-0,14486
15
- lazyqml/Factories/Models/Hybrid.py,sha256=R9Ztzhbut4A_87z7viUlH5RtboFfmRkxYqxO9ABkXkc,17740
16
- lazyqml/Factories/Models/QNNBag.py,sha256=UKTE8FpVkcxBBbE9MnL_cWi07idXUaF6sGCsKZ2OJzE,6560
17
- lazyqml/Factories/Models/QNNTorch.py,sha256=mJsr2uGaQ8teEB3gsF5aUZ8j_IlJSdOZsdnvLVJanLs,6588
18
- lazyqml/Factories/Models/QSVM.py,sha256=Jc-PHL8yn7VBrXEt4i44jsbsQHKF-FgwXvSWWwutK_A,3225
19
- lazyqml/Factories/Models/_QNNPennylane.py,sha256=cn7lSZ0tEps61xleIeI7oWyGxeotiwQc74dYVFe-rIc,3380
20
- lazyqml/Factories/Models/fModels.py,sha256=5Nsx7UFH_De4f5pMvx0D2giUIgKgA4q29g7_NwLybxc,1342
21
- lazyqml/Factories/Preprocessing/Pca.py,sha256=4TmNOMw6XrZ68qqDiUsB1eQ9BHLKiD1sanfI-dGqWjE,971
22
- lazyqml/Factories/Preprocessing/Sanitizer.py,sha256=8EoAfVZAGVpLD529vwqGTxAli7miPxW02pXb2IH5DE0,1117
23
- lazyqml/Factories/Preprocessing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
- lazyqml/Factories/Preprocessing/fPreprocessing.py,sha256=LPA4r0AFk67YbZVSAZTwTzC6oZ8P4tfpuDO8psnsTKQ,842
25
- lazyqml/Global/globalEnums.py,sha256=Qc4Xep-LnubsxUvb8ZW5h-XZVjLRFXWfv040NXIt4HY,962
26
- lazyqml/Interfaces/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
- lazyqml/Interfaces/iAnsatz.py,sha256=HzHRRg7OqKOJAW-I-huDdxnFwaTZtP7953VmranOzC8,156
28
- lazyqml/Interfaces/iCircuit.py,sha256=L-GbUQmJ2s0uc5AjJj4zIruWP7XSycpG-C8xI4_wnxc,115
29
- lazyqml/Interfaces/iModel.py,sha256=W_yYoZd7hS8ZKGvNAyl-waJ6f7F0kIM6zrg9WqyPt_I,176
30
- lazyqml/Interfaces/iPreprocessing.py,sha256=O9f2tCnWTbjkHi4_XKaPWsE2SWKsdI1pj2lCyBWih9o,255
31
- lazyqml/Utils/Utils.py,sha256=JMmN1ilzNXTnhA5PZaMZvEVbtnKFYW50xUejWDLeAfM,10034
32
- lazyqml/Utils/Validator.py,sha256=6Ox2A5WAV5GYPuFfB873mpEqCHSmhhSwFV_LGI-ZJ5s,4622
33
- lazyqml-3.0.4.dist-info/AUTHORS.rst,sha256=Y_bDRslOAz5wcAYrTAnjDlmlW-51LfVF0Xwf09TbW3Y,245
34
- lazyqml-3.0.4.dist-info/LICENSE,sha256=42X2ZTCkjjhUks41WOjPmwX8sbCfgf431zzdCne6gqE,1079
35
- lazyqml-3.0.4.dist-info/LICENSE copy,sha256=y9EYvUN_l9ZWDuiVcxHE1NWbfy_HR9Z-8G19719ynbQ,1077
36
- lazyqml-3.0.4.dist-info/METADATA,sha256=4s-pOHpe8x_UWEsLi0lsw0TV0wN5HHQ0oscmeutvcT0,9615
37
- lazyqml-3.0.4.dist-info/WHEEL,sha256=pxeNX5JdtCe58PUSYP9upmc7jdRPgvT0Gm9kb1SHlVw,109
38
- lazyqml-3.0.4.dist-info/entry_points.txt,sha256=I0WR08yVIeXjSa8XBSGZ9SsZtM8uMvKwZOdU1qQajao,45
39
- lazyqml-3.0.4.dist-info/top_level.txt,sha256=x2ffpytT-NeXmC7YaZLSQNMLK0pLfUiRmGOqwNbyjZE,8
40
- lazyqml-3.0.4.dist-info/RECORD,,