quantum-learn 0.0.1__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.
- quantum_learn-0.0.1/PKG-INFO +97 -0
- quantum_learn-0.0.1/README.md +79 -0
- quantum_learn-0.0.1/pyproject.toml +27 -0
- quantum_learn-0.0.1/qmlearn/__init__.py +3 -0
- quantum_learn-0.0.1/qmlearn/vqc.py +88 -0
- quantum_learn-0.0.1/quantum_learn.egg-info/PKG-INFO +97 -0
- quantum_learn-0.0.1/quantum_learn.egg-info/SOURCES.txt +10 -0
- quantum_learn-0.0.1/quantum_learn.egg-info/dependency_links.txt +1 -0
- quantum_learn-0.0.1/quantum_learn.egg-info/requires.txt +4 -0
- quantum_learn-0.0.1/quantum_learn.egg-info/top_level.txt +1 -0
- quantum_learn-0.0.1/setup.cfg +4 -0
- quantum_learn-0.0.1/tests/test_vqc.py +51 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: quantum-learn
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: quantum-learn: quantum machine learning in Python
|
|
5
|
+
Author-email: OsamaMIT <author@example.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
12
|
+
Requires-Python: >=3.6
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
Requires-Dist: pennylane
|
|
15
|
+
Requires-Dist: pandas
|
|
16
|
+
Requires-Dist: matplotlib
|
|
17
|
+
Requires-Dist: scikit-learn
|
|
18
|
+
|
|
19
|
+
# Quantum-Learn
|
|
20
|
+
|
|
21
|
+
[](https://pypi.org/project/quantum-learn/)
|
|
22
|
+
[](https://github.com/OsamaMIT/quantum-learn/blob/main/LICENSE)
|
|
23
|
+
[](https://pypi.org/project/quantum-learn/)
|
|
24
|
+
|
|
25
|
+
**Quantum-Learn** is an open-source Python library that simplifies **Quantum Machine Learning (QML)** using **PennyLane**. Inspired by **scikit-learn**, it provides a high-level interface for creating, training, and evaluating **Variational Quantum Circuits (VQCs)** with ease.
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
- **Simple API** for training quantum models
|
|
30
|
+
- Supports **Variational Quantum Circuits (VQC)**
|
|
31
|
+
- Works with **PennyLane**, **scikit-learn**, and standard ML tools
|
|
32
|
+
- Customizable **Ansätze** (quantum circuit templates)
|
|
33
|
+
- Compatible with both **classical simulators** and **real quantum devices**
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
Quantum-Learn requires **Python 3.6+**. Install it via pip:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install quantum-learn
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Or install from source:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
git clone https://github.com/OsamaMIT/quantum-learn.git
|
|
47
|
+
cd quantum-learn
|
|
48
|
+
pip install .
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Quick Start
|
|
52
|
+
### Train a Quantum Model
|
|
53
|
+
```python
|
|
54
|
+
Copy
|
|
55
|
+
Edit
|
|
56
|
+
import pennylane as qml
|
|
57
|
+
import pandas as pd
|
|
58
|
+
from quantum_learn import VariationalQuantumCircuit
|
|
59
|
+
|
|
60
|
+
# Create a sample dataset
|
|
61
|
+
features = pd.DataFrame({
|
|
62
|
+
"feature1": [0, 1],
|
|
63
|
+
"feature2": [1, 0]
|
|
64
|
+
})
|
|
65
|
+
labels = pd.DataFrame({
|
|
66
|
+
"label": [
|
|
67
|
+
[1, 0, 0, 0], # Encoded quantum state for class 0
|
|
68
|
+
[0, 0, 0, 1] # Encoded quantum state for class 1
|
|
69
|
+
]
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
# Initialize and train the model
|
|
73
|
+
vqc = VariationalQuantumCircuit()
|
|
74
|
+
vqc.train(features, labels, epochs=5)
|
|
75
|
+
|
|
76
|
+
# Make predictions
|
|
77
|
+
predictions = vqc.predict(features)
|
|
78
|
+
print(predictions)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Documentation
|
|
82
|
+
For detailed usage and examples, check out the Quantum-Learn Documentation.
|
|
83
|
+
|
|
84
|
+
## Roadmap
|
|
85
|
+
- Implement quantum kernel methods
|
|
86
|
+
- Add pre-built ansätze for VQCs
|
|
87
|
+
- Support more backends (IBM Q, Braket)
|
|
88
|
+
- Improve compatibility with scikit-learn
|
|
89
|
+
|
|
90
|
+
## Contributing
|
|
91
|
+
Contributions are welcome! To contribute:
|
|
92
|
+
|
|
93
|
+
Fork the repository
|
|
94
|
+
Create a new branch (feature-branch)
|
|
95
|
+
Commit your changes and open a pull request
|
|
96
|
+
License
|
|
97
|
+
This project is licensed under the MIT License. See the LICENSE file for details.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Quantum-Learn
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/quantum-learn/)
|
|
4
|
+
[](https://github.com/OsamaMIT/quantum-learn/blob/main/LICENSE)
|
|
5
|
+
[](https://pypi.org/project/quantum-learn/)
|
|
6
|
+
|
|
7
|
+
**Quantum-Learn** is an open-source Python library that simplifies **Quantum Machine Learning (QML)** using **PennyLane**. Inspired by **scikit-learn**, it provides a high-level interface for creating, training, and evaluating **Variational Quantum Circuits (VQCs)** with ease.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Simple API** for training quantum models
|
|
12
|
+
- Supports **Variational Quantum Circuits (VQC)**
|
|
13
|
+
- Works with **PennyLane**, **scikit-learn**, and standard ML tools
|
|
14
|
+
- Customizable **Ansätze** (quantum circuit templates)
|
|
15
|
+
- Compatible with both **classical simulators** and **real quantum devices**
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Quantum-Learn requires **Python 3.6+**. Install it via pip:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install quantum-learn
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or install from source:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
git clone https://github.com/OsamaMIT/quantum-learn.git
|
|
29
|
+
cd quantum-learn
|
|
30
|
+
pip install .
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
### Train a Quantum Model
|
|
35
|
+
```python
|
|
36
|
+
Copy
|
|
37
|
+
Edit
|
|
38
|
+
import pennylane as qml
|
|
39
|
+
import pandas as pd
|
|
40
|
+
from quantum_learn import VariationalQuantumCircuit
|
|
41
|
+
|
|
42
|
+
# Create a sample dataset
|
|
43
|
+
features = pd.DataFrame({
|
|
44
|
+
"feature1": [0, 1],
|
|
45
|
+
"feature2": [1, 0]
|
|
46
|
+
})
|
|
47
|
+
labels = pd.DataFrame({
|
|
48
|
+
"label": [
|
|
49
|
+
[1, 0, 0, 0], # Encoded quantum state for class 0
|
|
50
|
+
[0, 0, 0, 1] # Encoded quantum state for class 1
|
|
51
|
+
]
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
# Initialize and train the model
|
|
55
|
+
vqc = VariationalQuantumCircuit()
|
|
56
|
+
vqc.train(features, labels, epochs=5)
|
|
57
|
+
|
|
58
|
+
# Make predictions
|
|
59
|
+
predictions = vqc.predict(features)
|
|
60
|
+
print(predictions)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Documentation
|
|
64
|
+
For detailed usage and examples, check out the Quantum-Learn Documentation.
|
|
65
|
+
|
|
66
|
+
## Roadmap
|
|
67
|
+
- Implement quantum kernel methods
|
|
68
|
+
- Add pre-built ansätze for VQCs
|
|
69
|
+
- Support more backends (IBM Q, Braket)
|
|
70
|
+
- Improve compatibility with scikit-learn
|
|
71
|
+
|
|
72
|
+
## Contributing
|
|
73
|
+
Contributions are welcome! To contribute:
|
|
74
|
+
|
|
75
|
+
Fork the repository
|
|
76
|
+
Create a new branch (feature-branch)
|
|
77
|
+
Commit your changes and open a pull request
|
|
78
|
+
License
|
|
79
|
+
This project is licensed under the MIT License. See the LICENSE file for details.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "quantum-learn"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
description = "quantum-learn: quantum machine learning in Python"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [{ name = "OsamaMIT", email = "author@example.com" }]
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
requires-python = ">=3.6"
|
|
13
|
+
dependencies = [
|
|
14
|
+
"pennylane",
|
|
15
|
+
"pandas",
|
|
16
|
+
"matplotlib",
|
|
17
|
+
"scikit-learn"
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
# Fix: Make classifiers an array of strings
|
|
21
|
+
classifiers = [
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"License :: OSI Approved :: MIT License",
|
|
24
|
+
"Operating System :: OS Independent",
|
|
25
|
+
"Development Status :: 3 - Alpha",
|
|
26
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence"
|
|
27
|
+
]
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import pennylane as qml
|
|
2
|
+
from pennylane import numpy as np
|
|
3
|
+
import pandas as pd
|
|
4
|
+
|
|
5
|
+
class VariationalQuantumCircuit:
|
|
6
|
+
def __init__(self):
|
|
7
|
+
self.params = None
|
|
8
|
+
self.ansatz = None
|
|
9
|
+
|
|
10
|
+
def generator(self, features, params, n_qubits, device, ansatz=None):
|
|
11
|
+
@qml.qnode(device, diff_method="backprop")
|
|
12
|
+
def circuit(features, params):
|
|
13
|
+
if ansatz is not None:
|
|
14
|
+
return ansatz(features, params, n_qubits)
|
|
15
|
+
else:
|
|
16
|
+
# Default ansatz
|
|
17
|
+
for i in range(n_qubits):
|
|
18
|
+
qml.Rot(features[i] * params[i][0],
|
|
19
|
+
features[i] * params[i][1],
|
|
20
|
+
features[i] * params[i][2],
|
|
21
|
+
wires=i)
|
|
22
|
+
if i < n_qubits - 1:
|
|
23
|
+
qml.CNOT(wires=[i, i + 1])
|
|
24
|
+
return qml.state()
|
|
25
|
+
return circuit(features, params)
|
|
26
|
+
|
|
27
|
+
def train(self, features, labels, params=None, batch_size=32, epochs=1, n_qubits=None, device=None, ansatz=None,
|
|
28
|
+
optimizer=qml.AdamOptimizer(stepsize=0.05)):
|
|
29
|
+
|
|
30
|
+
if features is None or labels is None:
|
|
31
|
+
raise ValueError("Features and labels cannot be None.")
|
|
32
|
+
|
|
33
|
+
if n_qubits is None:
|
|
34
|
+
n_qubits = len(features.columns)
|
|
35
|
+
|
|
36
|
+
if device is None:
|
|
37
|
+
device = qml.device("default.qubit", wires=n_qubits)
|
|
38
|
+
|
|
39
|
+
if params is None:
|
|
40
|
+
params = np.random.randn(n_qubits, 3)
|
|
41
|
+
|
|
42
|
+
self.ansatz = ansatz
|
|
43
|
+
data = pd.concat([features, labels], axis=1)
|
|
44
|
+
|
|
45
|
+
def fidelity_loss(output, target):
|
|
46
|
+
state0 = qml.math.dm_from_state_vector(output)
|
|
47
|
+
state1 = qml.math.dm_from_state_vector(target)
|
|
48
|
+
error = 1 - qml.math.fidelity(state0, state1)
|
|
49
|
+
return error
|
|
50
|
+
|
|
51
|
+
def learn():
|
|
52
|
+
params = np.random.randn(n_qubits, 3)
|
|
53
|
+
print(params)
|
|
54
|
+
for epoch in range(epochs):
|
|
55
|
+
costs = []
|
|
56
|
+
for start_idx in range(0, len(data), batch_size):
|
|
57
|
+
end_idx = min(start_idx + batch_size, len(data))
|
|
58
|
+
batch_data = data.iloc[start_idx:end_idx]
|
|
59
|
+
|
|
60
|
+
def cost_function(params):
|
|
61
|
+
total_loss = 0
|
|
62
|
+
for _, row in batch_data.iterrows():
|
|
63
|
+
total_loss += fidelity_loss(
|
|
64
|
+
self.generator([row[feature] for feature in features.columns], params, n_qubits, device, ansatz),
|
|
65
|
+
[row[label] for label in labels.columns]
|
|
66
|
+
)
|
|
67
|
+
return qml.math.mean(total_loss / len(batch_data))
|
|
68
|
+
|
|
69
|
+
params, cost = optimizer.step_and_cost(cost_function, params)
|
|
70
|
+
costs.append(cost)
|
|
71
|
+
|
|
72
|
+
print(f'Epoch {epoch+1}, mean cost: {np.mean(costs)}')
|
|
73
|
+
print(f'Params: {params}')
|
|
74
|
+
return params
|
|
75
|
+
|
|
76
|
+
self.params = learn()
|
|
77
|
+
|
|
78
|
+
def predict(self, features, n_qubits=None, device=None, diff_method="backprop"):
|
|
79
|
+
if n_qubits is None:
|
|
80
|
+
n_qubits = len(features.columns)
|
|
81
|
+
if device is None:
|
|
82
|
+
device = qml.device("default.qubit", wires=n_qubits)
|
|
83
|
+
predictions = []
|
|
84
|
+
for _, row in features.iterrows():
|
|
85
|
+
feat = [row[feature] for feature in features.columns]
|
|
86
|
+
output = self.generator(feat, self.params, n_qubits, device, self.ansatz)
|
|
87
|
+
predictions.append(output)
|
|
88
|
+
return predictions
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: quantum-learn
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: quantum-learn: quantum machine learning in Python
|
|
5
|
+
Author-email: OsamaMIT <author@example.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
12
|
+
Requires-Python: >=3.6
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
Requires-Dist: pennylane
|
|
15
|
+
Requires-Dist: pandas
|
|
16
|
+
Requires-Dist: matplotlib
|
|
17
|
+
Requires-Dist: scikit-learn
|
|
18
|
+
|
|
19
|
+
# Quantum-Learn
|
|
20
|
+
|
|
21
|
+
[](https://pypi.org/project/quantum-learn/)
|
|
22
|
+
[](https://github.com/OsamaMIT/quantum-learn/blob/main/LICENSE)
|
|
23
|
+
[](https://pypi.org/project/quantum-learn/)
|
|
24
|
+
|
|
25
|
+
**Quantum-Learn** is an open-source Python library that simplifies **Quantum Machine Learning (QML)** using **PennyLane**. Inspired by **scikit-learn**, it provides a high-level interface for creating, training, and evaluating **Variational Quantum Circuits (VQCs)** with ease.
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
- **Simple API** for training quantum models
|
|
30
|
+
- Supports **Variational Quantum Circuits (VQC)**
|
|
31
|
+
- Works with **PennyLane**, **scikit-learn**, and standard ML tools
|
|
32
|
+
- Customizable **Ansätze** (quantum circuit templates)
|
|
33
|
+
- Compatible with both **classical simulators** and **real quantum devices**
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
Quantum-Learn requires **Python 3.6+**. Install it via pip:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install quantum-learn
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Or install from source:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
git clone https://github.com/OsamaMIT/quantum-learn.git
|
|
47
|
+
cd quantum-learn
|
|
48
|
+
pip install .
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Quick Start
|
|
52
|
+
### Train a Quantum Model
|
|
53
|
+
```python
|
|
54
|
+
Copy
|
|
55
|
+
Edit
|
|
56
|
+
import pennylane as qml
|
|
57
|
+
import pandas as pd
|
|
58
|
+
from quantum_learn import VariationalQuantumCircuit
|
|
59
|
+
|
|
60
|
+
# Create a sample dataset
|
|
61
|
+
features = pd.DataFrame({
|
|
62
|
+
"feature1": [0, 1],
|
|
63
|
+
"feature2": [1, 0]
|
|
64
|
+
})
|
|
65
|
+
labels = pd.DataFrame({
|
|
66
|
+
"label": [
|
|
67
|
+
[1, 0, 0, 0], # Encoded quantum state for class 0
|
|
68
|
+
[0, 0, 0, 1] # Encoded quantum state for class 1
|
|
69
|
+
]
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
# Initialize and train the model
|
|
73
|
+
vqc = VariationalQuantumCircuit()
|
|
74
|
+
vqc.train(features, labels, epochs=5)
|
|
75
|
+
|
|
76
|
+
# Make predictions
|
|
77
|
+
predictions = vqc.predict(features)
|
|
78
|
+
print(predictions)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Documentation
|
|
82
|
+
For detailed usage and examples, check out the Quantum-Learn Documentation.
|
|
83
|
+
|
|
84
|
+
## Roadmap
|
|
85
|
+
- Implement quantum kernel methods
|
|
86
|
+
- Add pre-built ansätze for VQCs
|
|
87
|
+
- Support more backends (IBM Q, Braket)
|
|
88
|
+
- Improve compatibility with scikit-learn
|
|
89
|
+
|
|
90
|
+
## Contributing
|
|
91
|
+
Contributions are welcome! To contribute:
|
|
92
|
+
|
|
93
|
+
Fork the repository
|
|
94
|
+
Create a new branch (feature-branch)
|
|
95
|
+
Commit your changes and open a pull request
|
|
96
|
+
License
|
|
97
|
+
This project is licensed under the MIT License. See the LICENSE file for details.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
qmlearn/__init__.py
|
|
4
|
+
qmlearn/vqc.py
|
|
5
|
+
quantum_learn.egg-info/PKG-INFO
|
|
6
|
+
quantum_learn.egg-info/SOURCES.txt
|
|
7
|
+
quantum_learn.egg-info/dependency_links.txt
|
|
8
|
+
quantum_learn.egg-info/requires.txt
|
|
9
|
+
quantum_learn.egg-info/top_level.txt
|
|
10
|
+
tests/test_vqc.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
qmlearn
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
import numpy as np
|
|
3
|
+
import pandas as pd
|
|
4
|
+
from qmlearn import VariationalQuantumCircuit
|
|
5
|
+
|
|
6
|
+
def simple_quantum_dataset():
|
|
7
|
+
# For a 2-qubit system, a valid state vector has 4 elements.
|
|
8
|
+
# Here we encode:
|
|
9
|
+
# 0 -> |00 = [1, 0, 0, 0]
|
|
10
|
+
# 1 -> |11 = [0, 0, 0, 1]
|
|
11
|
+
def encode(label):
|
|
12
|
+
return np.array([1, 0, 0, 0]) if label == 0 else np.array([0, 0, 0, 1])
|
|
13
|
+
|
|
14
|
+
data = pd.DataFrame({
|
|
15
|
+
"feature1": [0, 1, 0, 1],
|
|
16
|
+
"feature2": [0, 0, 1, 1],
|
|
17
|
+
"label": [encode(l) for l in [0, 1, 1, 0]]
|
|
18
|
+
})
|
|
19
|
+
return data
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class TestVariationalQuantumCircuit(unittest.TestCase):
|
|
23
|
+
|
|
24
|
+
def setUp(self):
|
|
25
|
+
# Setup simple quantum dataset
|
|
26
|
+
data = simple_quantum_dataset()
|
|
27
|
+
self.features = data[["feature1", "feature2"]]
|
|
28
|
+
self.labels = data[["label"]]
|
|
29
|
+
self.vqc = VariationalQuantumCircuit()
|
|
30
|
+
|
|
31
|
+
def test_train(self):
|
|
32
|
+
# Test if training works
|
|
33
|
+
self.vqc.train(self.features, self.labels, epochs=2)
|
|
34
|
+
self.assertIsNotNone(self.vqc.params)
|
|
35
|
+
|
|
36
|
+
def test_predict(self):
|
|
37
|
+
# Test if prediction works
|
|
38
|
+
self.vqc.train(self.features, self.labels, epochs=2)
|
|
39
|
+
predictions = self.vqc.predict(self.features)
|
|
40
|
+
self.assertEqual(len(predictions), len(self.features))
|
|
41
|
+
|
|
42
|
+
def test_invalid_features(self):
|
|
43
|
+
# Test invalid input handling
|
|
44
|
+
with self.assertRaises(ValueError):
|
|
45
|
+
self.vqc.train(None, self.labels, epochs=2)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
if __name__ == "__main__":
|
|
49
|
+
unittest.main()
|
|
50
|
+
|
|
51
|
+
#python -m unittest discover -s tests
|