lazyqml 2.0.4__tar.gz → 3.0.0__tar.gz

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.
Files changed (100) hide show
  1. {lazyqml-2.0.4 → lazyqml-3.0.0}/.github/workflows/installation.yml +1 -1
  2. {lazyqml-2.0.4 → lazyqml-3.0.0}/.github/workflows/pypi.yml +1 -1
  3. {lazyqml-2.0.4 → lazyqml-3.0.0}/.github/workflows/ubuntu.yml +1 -1
  4. lazyqml-3.0.0/LICENSE +21 -0
  5. {lazyqml-2.0.4 → lazyqml-3.0.0}/PKG-INFO +43 -30
  6. lazyqml-2.0.4/README.md → lazyqml-3.0.0/README copy.md +3 -4
  7. lazyqml-3.0.0/README.md +83 -0
  8. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Factories/Circuits/AmplitudeEmbedding.py +1 -1
  9. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Factories/Circuits/HCzRx.py +1 -1
  10. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Factories/Circuits/HardwareEfficient.py +1 -1
  11. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Factories/Circuits/RxEmbedding.py +1 -1
  12. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Factories/Circuits/RyEmbedding.py +1 -1
  13. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Factories/Circuits/RzEmbedding.py +1 -1
  14. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Factories/Circuits/TreeTensor.py +1 -1
  15. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Factories/Circuits/TwoLocal.py +1 -1
  16. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Factories/Circuits/ZzEmbedding.py +1 -1
  17. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Factories/Circuits/fCircuits.py +10 -10
  18. lazyqml-3.0.0/lazyqml/Factories/Dispatchers/Dispatcher.py +326 -0
  19. lazyqml-3.0.0/lazyqml/Factories/Models/Hybrid.py +460 -0
  20. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Factories/Models/QNNBag.py +6 -6
  21. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Factories/Models/QNNTorch.py +8 -8
  22. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Factories/Models/QSVM.py +3 -3
  23. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Factories/Models/_QNNPennylane.py +4 -4
  24. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Factories/Models/fModels.py +4 -4
  25. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Factories/Preprocessing/Pca.py +2 -2
  26. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Factories/Preprocessing/Sanitizer.py +2 -2
  27. lazyqml-3.0.0/lazyqml/Factories/Preprocessing/fPreprocessing.py +21 -0
  28. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Global/globalEnums.py +3 -1
  29. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Interfaces/iAnsatz.py +1 -1
  30. lazyqml-3.0.0/lazyqml/Utils/Utils.py +280 -0
  31. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Utils/Validator.py +4 -7
  32. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/__init__.py +1 -1
  33. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/lazyqml.py +54 -49
  34. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml.egg-info/PKG-INFO +43 -30
  35. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml.egg-info/SOURCES.txt +3 -21
  36. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml.egg-info/requires.txt +1 -0
  37. {lazyqml-2.0.4 → lazyqml-3.0.0}/pyproject.toml +6 -8
  38. lazyqml-3.0.0/requirements.txt +17 -0
  39. {lazyqml-2.0.4 → lazyqml-3.0.0}/requirements_dev.txt +2 -1
  40. lazyqml-3.0.0/tests/test_lazyqml.py +18 -0
  41. lazyqml-2.0.4/.github/workflows/macos.yml +0 -42
  42. lazyqml-2.0.4/.github/workflows/windows.yml +0 -34
  43. lazyqml-2.0.4/lazyqml/.lazyqmlP.py +0 -293
  44. lazyqml-2.0.4/lazyqml/.lazyqmlVote.py +0 -303
  45. lazyqml-2.0.4/lazyqml/Factories/Circuits/_Qkernel.py +0 -16
  46. lazyqml-2.0.4/lazyqml/Factories/Circuits/_Qnn.py +0 -17
  47. lazyqml-2.0.4/lazyqml/Factories/Dispatchers/Dispatcher.py +0 -147
  48. lazyqml-2.0.4/lazyqml/Factories/Dispatchers/DispatcherCV.py +0 -143
  49. lazyqml-2.0.4/lazyqml/Factories/Dispatchers/DispatcherNumba.py +0 -226
  50. lazyqml-2.0.4/lazyqml/Factories/Dispatchers/_Dispatcher.py +0 -188
  51. lazyqml-2.0.4/lazyqml/Factories/Dispatchers/_DispatcherMultiprocessing.py +0 -201
  52. lazyqml-2.0.4/lazyqml/Factories/Dispatchers/_QNNBagdispatcher.py +0 -2
  53. lazyqml-2.0.4/lazyqml/Factories/Dispatchers/_QNNdispatcher.py +0 -2
  54. lazyqml-2.0.4/lazyqml/Factories/Dispatchers/_QSVMdispatcher.py +0 -112
  55. lazyqml-2.0.4/lazyqml/Factories/Dispatchers/__Dispatcher.py +0 -193
  56. lazyqml-2.0.4/lazyqml/Factories/Preprocessing/_PcaAmp.py +0 -22
  57. lazyqml-2.0.4/lazyqml/Factories/Preprocessing/_PcaTree.py +0 -22
  58. lazyqml-2.0.4/lazyqml/Factories/Preprocessing/_PcaTreeAmp.py +0 -22
  59. lazyqml-2.0.4/lazyqml/Factories/Preprocessing/fPreprocessing.py +0 -40
  60. lazyqml-2.0.4/lazyqml/Lanza copy.sh +0 -32
  61. lazyqml-2.0.4/lazyqml/Lanza.sh +0 -21
  62. lazyqml-2.0.4/lazyqml/Utils/Utils.py +0 -161
  63. lazyqml-2.0.4/lazyqml/mem.py +0 -85
  64. lazyqml-2.0.4/requirements.txt +0 -66
  65. lazyqml-2.0.4/tests/LazyQML.ipynb +0 -454
  66. lazyqml-2.0.4/tests/test_lazyqml.py +0 -42
  67. {lazyqml-2.0.4 → lazyqml-3.0.0}/.editorconfig +0 -0
  68. {lazyqml-2.0.4 → lazyqml-3.0.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  69. {lazyqml-2.0.4 → lazyqml-3.0.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  70. {lazyqml-2.0.4 → lazyqml-3.0.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  71. {lazyqml-2.0.4 → lazyqml-3.0.0}/.github/workflows/docs-build.yml +0 -0
  72. {lazyqml-2.0.4 → lazyqml-3.0.0}/.github/workflows/docs.yml +0 -0
  73. {lazyqml-2.0.4 → lazyqml-3.0.0}/.gitignore +0 -0
  74. {lazyqml-2.0.4 → lazyqml-3.0.0}/AUTHORS.rst +0 -0
  75. /lazyqml-2.0.4/LICENSE → /lazyqml-3.0.0/LICENSE copy +0 -0
  76. {lazyqml-2.0.4 → lazyqml-3.0.0}/MANIFEST.in +0 -0
  77. {lazyqml-2.0.4 → lazyqml-3.0.0}/docs/authors.rst +0 -0
  78. {lazyqml-2.0.4 → lazyqml-3.0.0}/docs/changelog.md +0 -0
  79. {lazyqml-2.0.4 → lazyqml-3.0.0}/docs/common.md +0 -0
  80. {lazyqml-2.0.4 → lazyqml-3.0.0}/docs/contributing.md +0 -0
  81. {lazyqml-2.0.4 → lazyqml-3.0.0}/docs/examples/intro.ipynb +0 -0
  82. {lazyqml-2.0.4 → lazyqml-3.0.0}/docs/faq.md +0 -0
  83. {lazyqml-2.0.4 → lazyqml-3.0.0}/docs/index.md +0 -0
  84. {lazyqml-2.0.4 → lazyqml-3.0.0}/docs/installation.md +0 -0
  85. {lazyqml-2.0.4 → lazyqml-3.0.0}/docs/lazyqml.md +0 -0
  86. {lazyqml-2.0.4 → lazyqml-3.0.0}/docs/overrides/main.html +0 -0
  87. {lazyqml-2.0.4 → lazyqml-3.0.0}/docs/usage.md +0 -0
  88. {lazyqml-2.0.4 → lazyqml-3.0.0}/experimentallibs.txt +0 -0
  89. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Factories/Preprocessing/__init__.py +0 -0
  90. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Factories/__init__.py +0 -0
  91. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Interfaces/__init__.py +0 -0
  92. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Interfaces/iCircuit.py +0 -0
  93. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Interfaces/iModel.py +0 -0
  94. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml/Interfaces/iPreprocessing.py +0 -0
  95. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml.egg-info/dependency_links.txt +0 -0
  96. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml.egg-info/entry_points.txt +0 -0
  97. {lazyqml-2.0.4 → lazyqml-3.0.0}/lazyqml.egg-info/top_level.txt +0 -0
  98. {lazyqml-2.0.4 → lazyqml-3.0.0}/mkdocs.yml +0 -0
  99. {lazyqml-2.0.4 → lazyqml-3.0.0}/setup.cfg +0 -0
  100. {lazyqml-2.0.4 → lazyqml-3.0.0}/tests/__init__.py +0 -0
@@ -16,7 +16,7 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- python-version: ["3.9"]
19
+ python-version: ["3.10"]
20
20
 
21
21
  steps:
22
22
  - uses: actions/checkout@v4
@@ -16,7 +16,7 @@ jobs:
16
16
  - name: Set up Python
17
17
  uses: actions/setup-python@v5
18
18
  with:
19
- python-version: "3.x"
19
+ python-version: "3.10"
20
20
  - name: Install dependencies
21
21
  run: |
22
22
  python -m pip install --upgrade pip
@@ -18,7 +18,7 @@ jobs:
18
18
  matrix:
19
19
  config:
20
20
  # - { os: ubuntu-latest, py: "3.8" }
21
- - { os: ubuntu-latest, py: "3.9" }
21
+ - { os: ubuntu-latest, py: "3.10" }
22
22
  # - { os: ubuntu-latest, py: "3.10" }
23
23
  # - { os: ubuntu-latest, py: "3.11" }
24
24
  steps:
lazyqml-3.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 QHPC & SP Research Lab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,18 +1,19 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lazyqml
3
- Version: 2.0.4
3
+ Version: 3.0.0
4
4
  Summary: LazyQML benchmarking utility to test quantum machine learning models.
5
- Author-email: Diego García Vega <garciavdiego@uniovi.es>, Fernando Álvaro Plou Llorente <ploufernando@uniovi.es>, Alejandro Leal Castaño <lealcalejandro@uniovi.es>
5
+ Author-email: QHPC Group <qhpcgroup@gmail.com>
6
6
  License: MIT License
7
- Project-URL: Homepage, https://github.com/DiegoGV-Uniovi/lazyqml
7
+ Project-URL: Homepage, https://github.com/QHPC-SP-Research-Lab/LazyQML
8
8
  Keywords: lazyqml
9
9
  Classifier: Intended Audience :: Science/Research
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Natural Language :: English
12
- Classifier: Programming Language :: Python :: 3.9
13
- Requires-Python: >=3.8
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Requires-Python: >=3.9
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE
16
+ License-File: LICENSE copy
16
17
  License-File: AUTHORS.rst
17
18
  Requires-Dist: wheel
18
19
  Requires-Dist: tabulate
@@ -30,6 +31,7 @@ Requires-Dist: pydantic
30
31
  Requires-Dist: psutil
31
32
  Requires-Dist: pandas
32
33
  Requires-Dist: joblib
34
+ Requires-Dist: gputil
33
35
  Provides-Extra: all
34
36
  Requires-Dist: lazyqml[extra]; extra == "all"
35
37
  Provides-Extra: extra
@@ -38,20 +40,51 @@ Requires-Dist: pandas; extra == "extra"
38
40
  # LazyQML
39
41
 
40
42
 
41
- [![image](https://img.shields.io/pypi/v/lazyqml.svg)](https://pypi.python.org/pypi/lazyqml)
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)
42
52
 
53
+ <!-- ![Pennylane](https://assets.cloud.pennylane.ai/pennylane_website/generic/logo.svg) -->
43
54
 
44
- **pLazyQML: A parallel package for efficient execution of QML models on classical computers**
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
45
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
+ ```
46
76
 
77
+ ## License & Compatibility
47
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.
48
81
  ## Quantum and High Performance Computing (QHPC) - University of Oviedo
49
82
  - José Ranilla Pastor - ranilla@uniovi.es
50
83
  - Elías Fernández Combarro - efernandezca@uniovi.es
51
- - Diego García Vega - garciavdiego@uniovi.es
84
+ - Diego García Vega - diegogarciavega@gmail.com
52
85
  - Fernando Álvaro Plou Llorente - ploufernando@uniovi.es
53
86
  - Alejandro Leal Castaño - lealcalejandro@uniovi.es
54
- - Group - https://qhpc.grupos.uniovi.es/
87
+ - Group - https://qhpc.uniovi.es
55
88
 
56
89
  ## Parameters:
57
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.
@@ -75,7 +108,7 @@ Requires-Dist: pandas; extra == "extra"
75
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.
76
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.
77
110
  ## Functions:
78
- - **fit** _(X_train, Y_train, X_test, Y_test, showTable=True)_: Fit Classification algorithms to X_train and y_train, predict and score on X_test, y_test.
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).
79
112
  If the dimensions of the training vectors are not compatible with the different models, a
80
113
  PCA transformation will be used in order to reduce the dimensionality to a compatible space.
81
114
  All categories must be in the training data if there are new categories in the test date the
@@ -86,24 +119,4 @@ Requires-Dist: pandas; extra == "extra"
86
119
 
87
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,
88
121
  fits the model on the training set, evaluates it on the validation set, and aggregates the results.
89
- - **glue_hybrid** _(X,y,model,showTable=True)_:This function takes both the training and test data, along with a user-provided torch model. It connects the given model to a fully connected layer, which acts as a bridge between the classical neural network and the selected Quantum Neural Networks (QNNs). The combined model is then used to train on the data and make predictions on the test set, leveraging the strengths of both classical and quantum approaches.
90
- ## Usage:
91
- ```python
92
- from lazyqml.lazyqml import QuantumClassifier
93
- from lazyqml.Global.globalEnums import *
94
- from sklearn.datasets import load_breast_cancer, load_iris
95
- from sklearn.model_selection import train_test_split
96
- # Load data
97
- data = load_iris()
98
- X = data.data
99
- y = data.target
100
122
 
101
- # Split data
102
- X_train, X_test, y_train, y_test = train_test_split(X, y,test_size=.3,random_state =123)
103
-
104
- # Initialize L azyClass ifier
105
- classifier = QuantumClassifier(nqubits={4,8,16},verbose=True,sequential=False,backend=Backend.lightningQubit)
106
-
107
- # Fit and predict
108
- classifier.fit(X_train=X_train,y_train=y_train,X_test=X_test,y_test=y_test)
109
- ```
@@ -11,10 +11,10 @@
11
11
  ## Quantum and High Performance Computing (QHPC) - University of Oviedo
12
12
  - José Ranilla Pastor - ranilla@uniovi.es
13
13
  - Elías Fernández Combarro - efernandezca@uniovi.es
14
- - Diego García Vega - garciavdiego@uniovi.es
14
+ - Diego García Vega - diegogarciavega@gmail.com
15
15
  - Fernando Álvaro Plou Llorente - ploufernando@uniovi.es
16
16
  - Alejandro Leal Castaño - lealcalejandro@uniovi.es
17
- - Group - https://qhpc.grupos.uniovi.es/
17
+ - Group - https://qhpc.uniovi.es
18
18
 
19
19
  ## Parameters:
20
20
  - **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.
@@ -38,7 +38,7 @@
38
38
  - **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.
39
39
  - **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.
40
40
  ## Functions:
41
- - **fit** _(X_train, Y_train, X_test, Y_test, showTable=True)_: Fit Classification algorithms to X_train and y_train, predict and score on X_test, y_test.
41
+ - **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).
42
42
  If the dimensions of the training vectors are not compatible with the different models, a
43
43
  PCA transformation will be used in order to reduce the dimensionality to a compatible space.
44
44
  All categories must be in the training data if there are new categories in the test date the
@@ -49,7 +49,6 @@
49
49
 
50
50
  - **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,
51
51
  fits the model on the training set, evaluates it on the validation set, and aggregates the results.
52
- - **glue_hybrid** _(X,y,model,showTable=True)_:This function takes both the training and test data, along with a user-provided torch model. It connects the given model to a fully connected layer, which acts as a bridge between the classical neural network and the selected Quantum Neural Networks (QNNs). The combined model is then used to train on the data and make predictions on the test set, leveraging the strengths of both classical and quantum approaches.
53
52
  ## Usage:
54
53
  ```python
55
54
  from lazyqml.lazyqml import QuantumClassifier
@@ -0,0 +1,83 @@
1
+ # LazyQML
2
+
3
+
4
+ [![image](https://img.shields.io/badge/pypi-%23ececec.svg?style=for-the-badge&logo=pypi&logoColor=1f73b7)](https://pypi.python.org/pypi/lazyqml)
5
+ ![GitHub Actions](https://img.shields.io/badge/github%20actions-%232671E5.svg?style=for-the-badge&logo=githubactions&logoColor=white)
6
+ ![NumPy](https://img.shields.io/badge/numpy-%23013243.svg?style=for-the-badge&logo=numpy&logoColor=white)
7
+ ![Pandas](https://img.shields.io/badge/pandas-%23150458.svg?style=for-the-badge&logo=pandas&logoColor=white)
8
+ ![PyTorch](https://img.shields.io/badge/PyTorch-%23EE4C2C.svg?style=for-the-badge&logo=PyTorch&logoColor=white)
9
+ ![scikit-learn](https://img.shields.io/badge/scikit--learn-%23F7931E.svg?style=for-the-badge&logo=scikit-learn&logoColor=white)
10
+ ![nVIDIA](https://img.shields.io/badge/cuda-000000.svg?style=for-the-badge&logo=nVIDIA&logoColor=green)
11
+ <img src="https://assets.cloud.pennylane.ai/pennylane_website/generic/logo.svg" alt="Pennylane Logo" style="background-color: white; padding: 2px;" />
12
+ ![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black)
13
+
14
+ <!-- ![Pennylane](https://assets.cloud.pennylane.ai/pennylane_website/generic/logo.svg) -->
15
+
16
+ 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.
17
+ ## Usage
18
+ ```python
19
+ from lazyqml.lazyqml import QuantumClassifier
20
+ from lazyqml.Global.globalEnums import *
21
+ from sklearn.datasets import load_breast_cancer, load_iris
22
+ from sklearn.model_selection import train_test_split
23
+ # Load data
24
+ data = load_iris()
25
+ X = data.data
26
+ y = data.target
27
+
28
+ # Split data
29
+ X_train, X_test, y_train, y_test = train_test_split(X, y,test_size=.3,random_state =123)
30
+
31
+ # Initialize L azyClass ifier
32
+ classifier = QuantumClassifier(nqubits={4,8,16},verbose=True,sequential=False,backend=Backend.lightningQubit)
33
+
34
+ # Fit and predict
35
+ classifier.fit(X_train=X_train,y_train=y_train,X_test=X_test,y_test=y_test)
36
+ ```
37
+
38
+ ## License & Compatibility
39
+ - Free software: MIT License
40
+ - This Python package is only compatible with Linux systems.
41
+ - Hardware acceleration is only enabled using CUDA-compatible devices.
42
+ ## Quantum and High Performance Computing (QHPC) - University of Oviedo
43
+ - José Ranilla Pastor - ranilla@uniovi.es
44
+ - Elías Fernández Combarro - efernandezca@uniovi.es
45
+ - Diego García Vega - diegogarciavega@gmail.com
46
+ - Fernando Álvaro Plou Llorente - ploufernando@uniovi.es
47
+ - Alejandro Leal Castaño - lealcalejandro@uniovi.es
48
+ - Group - https://qhpc.uniovi.es
49
+
50
+ ## Parameters:
51
+ - **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.
52
+ - **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.
53
+ - **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.
54
+ - **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.
55
+ - **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.
56
+ - **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.
57
+ - **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.
58
+ - **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.
59
+ - **randomState** _int, optional (default=1234)_: An integer seed used to ensure the repeatability of experiments, making the results consistent across different runs.
60
+ - **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.
61
+ - **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.
62
+ - **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.
63
+ - **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).
64
+ - **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).
65
+ - **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.
66
+ - **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.
67
+ - **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.
68
+ - **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.
69
+ - **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.
70
+ - **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.
71
+ ## Functions:
72
+ - **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).
73
+ If the dimensions of the training vectors are not compatible with the different models, a
74
+ PCA transformation will be used in order to reduce the dimensionality to a compatible space.
75
+ All categories must be in the training data if there are new categories in the test date the
76
+ function will not work. The objective variable must be in a numerical form like LabelEncoder or
77
+ OrdinalEncoder. Onehot or strings won't work.
78
+ - **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,
79
+ fits the model on the training set, evaluates it on the validation set, and aggregates the results.
80
+
81
+ - **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,
82
+ fits the model on the training set, evaluates it on the validation set, and aggregates the results.
83
+
@@ -1,4 +1,4 @@
1
- from lazyqml.Interfaces.iCircuit import Circuit
1
+ from Interfaces.iCircuit import Circuit
2
2
  import pennylane as qml
3
3
 
4
4
  class AmplitudeEmbedding(Circuit):
@@ -1,4 +1,4 @@
1
- from lazyqml.Interfaces.iAnsatz import Ansatz
1
+ from Interfaces.iAnsatz import Ansatz
2
2
  import pennylane as qml
3
3
 
4
4
  class HCzRx(Ansatz):
@@ -1,4 +1,4 @@
1
- from lazyqml.Interfaces.iAnsatz import Ansatz
1
+ from Interfaces.iAnsatz import Ansatz
2
2
  import pennylane as qml
3
3
 
4
4
  class HardwareEfficient(Ansatz):
@@ -1,4 +1,4 @@
1
- from lazyqml.Interfaces.iCircuit import Circuit
1
+ from Interfaces.iCircuit import Circuit
2
2
  import pennylane as qml
3
3
 
4
4
  class RxEmbedding(Circuit):
@@ -1,4 +1,4 @@
1
- from lazyqml.Interfaces.iCircuit import Circuit
1
+ from Interfaces.iCircuit import Circuit
2
2
  import pennylane as qml
3
3
 
4
4
  class RyEmbedding(Circuit):
@@ -1,4 +1,4 @@
1
- from lazyqml.Interfaces.iCircuit import Circuit
1
+ from Interfaces.iCircuit import Circuit
2
2
  import pennylane as qml
3
3
 
4
4
  class RzEmbedding(Circuit):
@@ -1,4 +1,4 @@
1
- from lazyqml.Interfaces.iAnsatz import Ansatz
1
+ from Interfaces.iAnsatz import Ansatz
2
2
  import pennylane as qml
3
3
  import numpy as np
4
4
 
@@ -1,4 +1,4 @@
1
- from lazyqml.Interfaces.iAnsatz import Ansatz
1
+ from Interfaces.iAnsatz import Ansatz
2
2
  import pennylane as qml
3
3
  import numpy as np
4
4
 
@@ -1,4 +1,4 @@
1
- from lazyqml.Interfaces.iCircuit import Circuit
1
+ from 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 lazyqml.Global.globalEnums import Ansatzs, Embedding
2
+ from Global.globalEnums import Ansatzs, Embedding
3
3
  # Importing Ansatzs
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 *
4
+ from Factories.Circuits.TwoLocal import *
5
+ from Factories.Circuits.HardwareEfficient import *
6
+ from Factories.Circuits.TreeTensor import *
7
+ from Factories.Circuits.HCzRx import *
8
8
  # Importing Embeddings
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 *
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 *
14
14
 
15
15
 
16
16
  class CircuitFactory: