psiqit.qml
Auto-generated documentation for the psiqit.qml module.
psiqit.qml
PSIQIT - Python Scientific Quantum Information Toolkit Quantum Machine Learning Module
This module provides quantum machine learning algorithms and models.
Submodules:
qgan.py - Quantum Generative Adversarial Networks qnn.py - Quantum Neural Networks qsvm.py - Quantum Support Vector Machines vqc.py - Variational Quantum Classifiers quantum_kernel.py - Quantum Kernel Methods
QGANResult
dataclass
Result container for Quantum GAN training
Attributes:
| Name | Type | Description |
|---|---|---|
generator_loss |
List[float]
|
Loss history of the generator |
discriminator_loss |
List[float]
|
Loss history of the discriminator |
fidelity_history |
List[float]
|
Fidelity between generated and target states |
epoch_history |
List[int]
|
Epoch numbers |
success |
bool
|
Whether training was successful |
final_generator |
Optional[Dict[str, Any]]
|
Final generator parameters |
final_discriminator |
Optional[Dict[str, Any]]
|
Final discriminator parameters |
generated_states |
List[Ket]
|
List of generated states during training |
target_states |
List[Ket]
|
Target states used for training |
n_epochs |
int
|
Number of epochs trained |
Source code in psiqit\qml\qgan.py
get_best_fidelity()
QuantumGenerator
Quantum generator for QGAN
Generates quantum states from latent vectors using a parameterized quantum circuit.
Example
gen = QuantumGenerator(n_qubits=2, n_latent=2, n_layers=2) latent = np.array([0.1, 0.2]) state = gen.generate(latent) print(state)
Source code in psiqit\qml\qgan.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |
__init__(n_qubits, n_latent=2, n_layers=2, entangler='cnot')
Initialize quantum generator
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_qubits
|
int
|
Number of qubits for the generated state |
required |
n_latent
|
int
|
Dimension of latent space |
2
|
n_layers
|
int
|
Number of variational layers |
2
|
entangler
|
str
|
Type of entangling gate ('cnot', 'cz', 'swap') |
'cnot'
|
Source code in psiqit\qml\qgan.py
generate(z=None, params=None)
Generate a quantum state from a latent vector
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
Optional[ndarray]
|
Latent vector (if None, uses random) |
None
|
params
|
Optional[ndarray]
|
Generator parameters (if None, uses current params) |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Ket |
Ket
|
Generated state |
Example
z = np.random.randn(2) state = gen.generate(z)
Source code in psiqit\qml\qgan.py
set_params(params)
get_params()
get_state_from_params(params)
Get the state generated by a specific parameter set
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
ndarray
|
Generator parameters |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Ket |
Ket
|
Generated state |
Source code in psiqit\qml\qgan.py
QuantumDiscriminator
Quantum discriminator for QGAN
Distinguishes between real (target) and generated states using a parameterized quantum circuit.
Example
disc = QuantumDiscriminator(n_qubits=2, n_layers=2) state = Ket([1, 0, 0, 0]) score = disc.discriminate(state) print(score)
Source code in psiqit\qml\qgan.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | |
__init__(n_qubits, n_layers=2, entangler='cnot')
Initialize quantum discriminator
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_qubits
|
int
|
Number of qubits |
required |
n_layers
|
int
|
Number of variational layers |
2
|
entangler
|
str
|
Type of entangling gate |
'cnot'
|
Source code in psiqit\qml\qgan.py
discriminate(state, params=None)
Discriminate between real and generated states
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
Union[Ket, ndarray]
|
Quantum state to classify |
required |
params
|
Optional[ndarray]
|
Discriminator parameters (if None, uses current params) |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Score (0-1), 1 = real, 0 = generated |
Example
state = Ket([1, 0, 0, 0]) score = disc.discriminate(state)
Source code in psiqit\qml\qgan.py
set_params(params)
ClassicalDiscriminator
Classical discriminator for QGAN
A simple neural network that distinguishes between real and generated states using the state vector amplitudes.
Example
disc = ClassicalDiscriminator(input_dim=4, hidden_dims=[8, 4]) state = Ket([1, 0, 0, 0]) score = disc.discriminate(state) print(score)
Source code in psiqit\qml\qgan.py
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 | |
__init__(input_dim, hidden_dims=[64, 32], learning_rate=0.01)
Initialize classical discriminator
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_dim
|
int
|
Input dimension (2^n_qubits) |
required |
hidden_dims
|
List[int]
|
List of hidden layer dimensions |
[64, 32]
|
learning_rate
|
float
|
Learning rate for training |
0.01
|
Source code in psiqit\qml\qgan.py
discriminate(state)
Discriminate between real and generated states
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
Union[Ket, ndarray]
|
Quantum state to classify |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Score (0-1), 1 = real, 0 = generated |
Source code in psiqit\qml\qgan.py
train_step(real_states, fake_states)
Perform a training step for the discriminator
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
real_states
|
List[Ket]
|
List of real (target) states |
required |
fake_states
|
List[Ket]
|
List of generated states |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Tuple |
Tuple[float, float]
|
(real_loss, fake_loss) |
Source code in psiqit\qml\qgan.py
QGAN
Quantum Generative Adversarial Network
A quantum GAN for generating quantum states that match a target distribution using adversarial training.
Example
Define target states (e.g., Bell states)
from psiqit.quantum import bell_phi_plus target_states = [bell_phi_plus()] qgan = QGAN(n_qubits=2, n_latent=2, n_layers=2) result = qgan.train(target_states, epochs=50) print(result.fidelity_history[-1])
Source code in psiqit\qml\qgan.py
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 | |
__init__(n_qubits, n_latent=2, n_layers=2, discriminator_type='classical', learning_rate=0.01, entangler='cnot')
Initialize QGAN
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_qubits
|
int
|
Number of qubits |
required |
n_latent
|
int
|
Dimension of latent space |
2
|
n_layers
|
int
|
Number of variational layers |
2
|
discriminator_type
|
str
|
'quantum' or 'classical' |
'classical'
|
learning_rate
|
float
|
Learning rate for training |
0.01
|
entangler
|
str
|
Type of entangling gate |
'cnot'
|
Source code in psiqit\qml\qgan.py
train(target_states, epochs=50, batch_size=10, learning_rate=None, verbose=True)
Train the QGAN
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_states
|
List[Ket]
|
List of target states to learn |
required |
epochs
|
int
|
Number of training epochs |
50
|
batch_size
|
int
|
Batch size for training |
10
|
learning_rate
|
Optional[float]
|
Learning rate (overrides default) |
None
|
verbose
|
bool
|
Print progress |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
QGANResult |
QGANResult
|
Training results |
Example
from psiqit.quantum import bell_phi_plus target = [bell_phi_plus()] result = qgan.train(target, epochs=50) print(result.final_fidelity)
Source code in psiqit\qml\qgan.py
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 | |
generate(n_samples=1, latent_vectors=None)
Generate quantum states using the trained generator
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_samples
|
int
|
Number of samples to generate |
1
|
latent_vectors
|
Optional[List[ndarray]]
|
List of latent vectors (if None, random) |
None
|
Returns:
| Type | Description |
|---|---|
List[Ket]
|
List[Ket]: Generated states |
Example
states = qgan.generate(n_samples=5) for s in states: ... print(s)
Source code in psiqit\qml\qgan.py
get_generator()
QNNResult
dataclass
Result container for Quantum Neural Network training
Attributes:
| Name | Type | Description |
|---|---|---|
final_loss |
float
|
Final loss value |
accuracy |
float
|
Final accuracy (for classification tasks) |
epochs |
int
|
Number of epochs trained |
params |
Optional[ndarray]
|
Final parameters |
predictions |
Optional[ndarray]
|
Final predictions |
loss_history |
List[float]
|
Loss history during training |
accuracy_history |
List[float]
|
Accuracy history during training |
success |
bool
|
Whether training was successful |
Source code in psiqit\qml\qnn.py
QNNLayer
A layer in a Quantum Neural Network
Consists of single-qubit rotations followed by entanglement.
Example
layer = QNNLayer(n_qubits=2, entangler='cnot') circuit = QuantumCircuit(2) params = np.random.randn(6) layer.apply(circuit, params)
Source code in psiqit\qml\qnn.py
__init__(n_qubits, entangler='cnot')
Initialize a QNN layer
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_qubits
|
int
|
Number of qubits |
required |
entangler
|
str
|
Type of entangling gate ('cnot', 'cz', 'swap') |
'cnot'
|
Source code in psiqit\qml\qnn.py
apply(circuit, params, start_idx=0)
Apply the layer to a circuit
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
circuit
|
QuantumCircuit
|
QuantumCircuit object |
required |
params
|
ndarray
|
Parameters for the layer |
required |
start_idx
|
int
|
Starting index for parameters |
0
|
Source code in psiqit\qml\qnn.py
QNN
Quantum Neural Network
A variational quantum circuit that can be trained for classification and regression tasks.
Example
from psiqit.qml import QNN
Create a QNN for binary classification
qnn = QNN(n_qubits=2, n_layers=3)
Train on synthetic data
X = np.random.randn(100, 2) # Features y = np.random.randint(0, 2, 100) # Labels result = qnn.train(X, y, epochs=50) print(result.accuracy)
Source code in psiqit\qml\qnn.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | |
__init__(n_qubits, n_layers=3, entangler='cnot', measurement='z')
Initialize Quantum Neural Network
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_qubits
|
int
|
Number of qubits (features will be encoded here) |
required |
n_layers
|
int
|
Number of variational layers |
3
|
entangler
|
str
|
Type of entangling gate ('cnot', 'cz', 'swap') |
'cnot'
|
measurement
|
str
|
Measurement basis ('z', 'x', 'y') |
'z'
|
Source code in psiqit\qml\qnn.py
set_params(params)
Set the parameters of the QNN
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
ndarray
|
Parameter vector |
required |
Source code in psiqit\qml\qnn.py
build_circuit(input_state=None)
Build the QNN circuit
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_state
|
Optional[Union[Ket, ndarray]]
|
Input state (if None, uses |0...0⟩) |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
QuantumCircuit |
QuantumCircuit
|
The QNN circuit |
Example
circ = qnn.build_circuit() print(circ.draw())
Source code in psiqit\qml\qnn.py
forward(input_state=None)
Forward pass through the QNN
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_state
|
Optional[Union[Ket, ndarray]]
|
Input state (if None, uses |0...0⟩) |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Ket |
Ket
|
Output state |
Example
state = qnn.forward() print(state)
Source code in psiqit\qml\qnn.py
measure_expectation(input_state=None)
Measure the expectation value of the QNN output
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_state
|
Optional[Union[Ket, ndarray]]
|
Input state |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Expectation value (-1 to 1) |
Example
expectation = qnn.measure_expectation() print(expectation)
Source code in psiqit\qml\qnn.py
predict(X, as_probability=True)
Make predictions for a set of inputs
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Input data (n_samples x n_features) |
required |
as_probability
|
bool
|
Return probabilities (True) or binary predictions (False) |
True
|
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: Predictions |
Example
X_test = np.random.randn(10, 2) predictions = qnn.predict(X_test)
Source code in psiqit\qml\qnn.py
loss(X, y)
Compute the loss (binary cross-entropy)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Input data |
required |
y
|
ndarray
|
Labels (0 or 1) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Loss value |
Example
loss = qnn.loss(X_train, y_train)
Source code in psiqit\qml\qnn.py
accuracy(X, y)
Compute the accuracy
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Input data |
required |
y
|
ndarray
|
Labels (0 or 1) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Accuracy (0-1) |
Example
acc = qnn.accuracy(X_test, y_test)
Source code in psiqit\qml\qnn.py
train(X, y, epochs=100, learning_rate=0.1, batch_size=None, verbose=True)
Train the QNN
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Input data (n_samples x n_features) |
required |
y
|
ndarray
|
Labels (0 or 1) |
required |
epochs
|
int
|
Number of training epochs |
100
|
learning_rate
|
float
|
Learning rate |
0.1
|
batch_size
|
Optional[int]
|
Batch size (if None, uses full batch) |
None
|
verbose
|
bool
|
Print progress |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
QNNResult |
QNNResult
|
Training results |
Example
result = qnn.train(X_train, y_train, epochs=50) print(f"Final accuracy: {result.accuracy}")
Source code in psiqit\qml\qnn.py
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | |
QuantumClassifier
VariationalQuantumCircuit
Bases: QNN
Variational Quantum Circuit - Alias for QNN
A parameterized quantum circuit for variational algorithms.
Source code in psiqit\qml\qnn.py
SVMResult
dataclass
Result container for SVM training
Attributes:
| Name | Type | Description |
|---|---|---|
support_vectors |
Optional[ndarray]
|
Support vectors |
alphas |
Optional[ndarray]
|
Lagrange multipliers |
bias |
float
|
Bias term |
n_support |
int
|
Number of support vectors |
accuracy |
float
|
Training accuracy |
classes |
Optional[ndarray]
|
Unique classes |
n_iterations |
int
|
Number of iterations |
success |
bool
|
Whether training was successful |
Source code in psiqit\qml\qsvm.py
QSVM
Quantum Support Vector Machine
A support vector machine that uses quantum kernels for classification. Supports both classical kernels (linear, RBF) and quantum kernels.
Example
from psiqit.qml import QSVM
Create a QSVM with quantum kernel
qsvm = QSVM(n_qubits=2, kernel_type='quantum', C=1.0)
Train on synthetic data
X = np.random.randn(100, 2) y = np.random.randint(0, 2, 100) result = qsvm.fit(X, y) print(result.accuracy)
Source code in psiqit\qml\qsvm.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | |
__init__(n_qubits=2, kernel_type='quantum', C=1.0, feature_map='zz', gamma=1.0)
Initialize Quantum SVM
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_qubits
|
int
|
Number of qubits for quantum kernel |
2
|
kernel_type
|
str
|
'linear', 'rbf', or 'quantum' |
'quantum'
|
C
|
float
|
Regularization parameter |
1.0
|
feature_map
|
str
|
Type of feature map for quantum kernel ('zz', 'xy', 'custom') |
'zz'
|
gamma
|
float
|
Gamma parameter for RBF kernel |
1.0
|
Source code in psiqit\qml\qsvm.py
fit(X, y, max_iter=100)
Train the QSVM
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Training data (n_samples x n_features) |
required |
y
|
ndarray
|
Labels (0 or 1) |
required |
max_iter
|
int
|
Maximum iterations for solver |
100
|
Returns:
| Name | Type | Description |
|---|---|---|
SVMResult |
SVMResult
|
Training results |
Example
result = qsvm.fit(X_train, y_train) print(result.accuracy)
Source code in psiqit\qml\qsvm.py
predict(X)
Predict labels for multiple samples
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Test data (n_samples x n_features) |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: Predicted labels |
Example
predictions = qsvm.predict(X_test)
Source code in psiqit\qml\qsvm.py
decision_function(X)
Compute decision function values for multiple samples
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Test data (n_samples x n_features) |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: Decision values |
Example
decisions = qsvm.decision_function(X_test)
Source code in psiqit\qml\qsvm.py
score(X, y)
Compute accuracy on test data
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Test data |
required |
y
|
ndarray
|
True labels |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Accuracy (0-1) |
Example
accuracy = qsvm.score(X_test, y_test)
Source code in psiqit\qml\qsvm.py
get_kernel_matrix(X)
Compute the kernel matrix for the given data
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Data matrix |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: Kernel matrix |
get_support_vectors()
get_alphas()
VQCResult
dataclass
Result container for Variational Quantum Circuit optimization
Attributes:
| Name | Type | Description |
|---|---|---|
optimal_params |
Optional[ndarray]
|
Optimal parameters found |
optimal_cost |
float
|
Optimal cost value |
n_iterations |
int
|
Number of iterations |
history |
List[float]
|
History of cost values |
success |
bool
|
Whether optimization was successful |
message |
str
|
Additional message |
Source code in psiqit\qml\vqc.py
VariationalLayer
A variational layer for VQC
Consists of single-qubit rotations followed by entanglement.
Example
layer = VariationalLayer(n_qubits=2, entangler='cnot') circuit = QuantumCircuit(2) params = np.random.randn(6) layer.apply(circuit, params)
Source code in psiqit\qml\vqc.py
__init__(n_qubits, entangler='cnot')
Initialize a variational layer
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_qubits
|
int
|
Number of qubits |
required |
entangler
|
str
|
Type of entangling gate ('cnot', 'cz', 'swap') |
'cnot'
|
Source code in psiqit\qml\vqc.py
apply(circuit, params, start_idx=0)
Apply the layer to a circuit
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
circuit
|
QuantumCircuit
|
QuantumCircuit object |
required |
params
|
ndarray
|
Parameters for the layer |
required |
start_idx
|
int
|
Starting index for parameters |
0
|
Source code in psiqit\qml\vqc.py
VQC
Variational Quantum Circuit
A parameterized quantum circuit that can be optimized for various tasks including classification and Hamiltonian ground state finding.
Example
from psiqit.qml import VQC
Create a VQC for classification
vqc = VQC(n_qubits=2, n_layers=3)
Optimize for a specific cost function
def cost(params): ... vqc.set_params(params) ... return vqc.measure() result = vqc.optimize(cost_function=cost, n_iterations=50) print(result.optimal_cost)
Source code in psiqit\qml\vqc.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | |
__init__(n_qubits, n_layers=3, entangler='cnot', measurement='z')
Initialize Variational Quantum Circuit
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_qubits
|
int
|
Number of qubits |
required |
n_layers
|
int
|
Number of variational layers |
3
|
entangler
|
str
|
Type of entangling gate ('cnot', 'cz', 'swap') |
'cnot'
|
measurement
|
str
|
Measurement basis ('z', 'x', 'y') |
'z'
|
Source code in psiqit\qml\vqc.py
set_params(params)
Set the parameters of the VQC
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
ndarray
|
Parameter vector |
required |
Source code in psiqit\qml\vqc.py
build_circuit(input_state=None)
Build the VQC circuit
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_state
|
Optional[Union[Ket, ndarray]]
|
Input state (if None, uses |0...0⟩) |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
QuantumCircuit |
QuantumCircuit
|
The VQC circuit |
Example
circ = vqc.build_circuit() print(circ.draw())
Source code in psiqit\qml\vqc.py
get_state(input_state=None)
Get the output state of the VQC
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_state
|
Optional[Union[Ket, ndarray]]
|
Input state |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Ket |
Ket
|
Output state |
Example
state = vqc.get_state() print(state)
Source code in psiqit\qml\vqc.py
measure(input_state=None)
Measure the expectation value of the VQC output
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_state
|
Optional[Union[Ket, ndarray]]
|
Input state |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Expectation value (-1 to 1) |
Example
expectation = vqc.measure() print(expectation)
Source code in psiqit\qml\vqc.py
evaluate_cost(params=None, input_state=None)
Evaluate the cost function for given parameters
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Optional[ndarray]
|
Parameters (if None, uses current params) |
None
|
input_state
|
Optional[Union[Ket, ndarray]]
|
Input state |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Cost value |
Example
cost = vqc.evaluate_cost() print(cost)
Source code in psiqit\qml\vqc.py
parameter_shift_gradient(param_idx, input_state=None, epsilon=1e-05)
Compute the gradient using parameter-shift rule
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
param_idx
|
int
|
Parameter index |
required |
input_state
|
Optional[Union[Ket, ndarray]]
|
Input state |
None
|
epsilon
|
float
|
Small shift for finite difference |
1e-05
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Gradient value |
Example
grad = vqc.parameter_shift_gradient(0) print(grad)
Source code in psiqit\qml\vqc.py
gradient(input_state=None)
Compute the full gradient
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_state
|
Optional[Union[Ket, ndarray]]
|
Input state |
None
|
Returns:
| Type | Description |
|---|---|
List[float]
|
List[float]: Gradient vector |
Example
grad = vqc.gradient() print(len(grad)) # n_params
Source code in psiqit\qml\vqc.py
optimize(cost_function=None, n_iterations=100, learning_rate=0.1, input_state=None, verbose=True)
Optimize the VQC parameters using gradient descent
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cost_function
|
Optional[Callable]
|
Cost function (if None, uses evaluate_cost) |
None
|
n_iterations
|
int
|
Number of iterations |
100
|
learning_rate
|
float
|
Learning rate |
0.1
|
input_state
|
Optional[Union[Ket, ndarray]]
|
Input state |
None
|
verbose
|
bool
|
Print progress |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
VQCResult |
VQCResult
|
Optimization results |
Example
result = vqc.optimize(n_iterations=50) print(result.optimal_cost)
Source code in psiqit\qml\vqc.py
HamiltonianVQE
Bases: VQC
Hamiltonian Variational Quantum Eigensolver (VQE)
A specialized VQC for finding the ground state energy of a Hamiltonian.
Example
from psiqit.qml import HamiltonianVQE from psiqit.quantum import pauli_z
Create Hamiltonian (e.g., for H2 molecule)
hamiltonian = {'Z0Z1': 1.0, 'Z0': 0.5, 'Z1': -0.5} vqe = HamiltonianVQE(n_qubits=2, hamiltonian=hamiltonian, n_layers=2) result = vqe.run(n_iterations=50) print(result.optimal_cost)
Source code in psiqit\qml\vqc.py
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 | |
__init__(n_qubits, hamiltonian, n_layers=3, entangler='cnot')
Initialize Hamiltonian VQE
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_qubits
|
int
|
Number of qubits |
required |
hamiltonian
|
Dict[str, float]
|
Hamiltonian as Pauli strings {'Z0Z1': 1.0, 'X0': 0.5, ...} |
required |
n_layers
|
int
|
Number of variational layers |
3
|
entangler
|
str
|
Type of entangling gate |
'cnot'
|
Source code in psiqit\qml\vqc.py
evaluate_hamiltonian(params=None)
Evaluate the Hamiltonian expectation value
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Optional[ndarray]
|
Parameters (if None, uses current params) |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Hamiltonian expectation value |
Example
energy = vqe.evaluate_hamiltonian() print(energy)
Source code in psiqit\qml\vqc.py
run(n_iterations=100, learning_rate=0.1, verbose=True)
Run the VQE optimization
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_iterations
|
int
|
Number of iterations |
100
|
learning_rate
|
float
|
Learning rate |
0.1
|
verbose
|
bool
|
Print progress |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
VQCResult |
VQCResult
|
Optimization results |
Example
result = vqe.run(n_iterations=50) print(result.optimal_cost)
Source code in psiqit\qml\vqc.py
get_energy_spectrum(n_states=5)
Get the energy spectrum of the Hamiltonian (classical computation)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_states
|
int
|
Number of lowest states to return |
5
|
Returns:
| Type | Description |
|---|---|
List[float]
|
List[float]: Energy eigenvalues |
Example
spectrum = vqe.get_energy_spectrum() print(spectrum[0]) # Ground state energy
Source code in psiqit\qml\vqc.py
KernelResult
dataclass
Result container for kernel evaluation
Attributes:
| Name | Type | Description |
|---|---|---|
value |
float
|
Kernel value |
fidelity |
float
|
Fidelity between quantum states |
distance |
float
|
Distance between feature vectors |
shots |
int
|
Number of shots used |
n_qubits |
int
|
Number of qubits |
method |
str
|
Method used for evaluation |
Source code in psiqit\qml\quantum_kernel.py
QuantumKernel
Quantum Kernel for machine learning
Implements quantum feature maps and kernel functions for use in quantum machine learning algorithms.
Example
from psiqit.qml import QuantumKernel
Create quantum kernel
kernel = QuantumKernel(n_qubits=2, feature_map='zz', n_layers=2)
Evaluate kernel between two data points
x1 = np.array([0.5, 0.3]) x2 = np.array([0.2, 0.7]) result = kernel.evaluate(x1, x2) print(result.value)
Source code in psiqit\qml\quantum_kernel.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | |
__init__(n_qubits, feature_map='zz', n_layers=2)
Initialize Quantum Kernel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_qubits
|
int
|
Number of qubits |
required |
feature_map
|
str
|
Type of feature map ('zz', 'xy', 'custom') |
'zz'
|
n_layers
|
int
|
Number of layers for the feature map |
2
|
Source code in psiqit\qml\quantum_kernel.py
evaluate(x1, x2, shots=1024)
Evaluate the quantum kernel between two data points
K(x1, x2) = |⟨ψ(x1)|ψ(x2)⟩|²
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
ndarray
|
First feature vector |
required |
x2
|
ndarray
|
Second feature vector |
required |
shots
|
int
|
Number of shots for estimation |
1024
|
Returns:
| Name | Type | Description |
|---|---|---|
KernelResult |
KernelResult
|
Kernel evaluation results |
Example
result = kernel.evaluate(x1, x2) print(result.value)
Source code in psiqit\qml\quantum_kernel.py
kernel_matrix(X, shots=1024)
Compute the full kernel matrix for a dataset
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Data matrix (n_samples x n_features) |
required |
shots
|
int
|
Number of shots for estimation |
1024
|
Returns:
| Type | Description |
|---|---|
List[List[float]]
|
List[List[float]]: Kernel matrix |
Example
K = kernel.kernel_matrix(X) print(K[0][1]) # Kernel between sample 0 and 1
Source code in psiqit\qml\quantum_kernel.py
kernel_alignment(X, y, shots=1024)
Compute kernel alignment with labels
Alignment = ⟨K, yyᵀ⟩ / (||K|| * ||yyᵀ||)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Data matrix |
required |
y
|
ndarray
|
Labels |
required |
shots
|
int
|
Number of shots for estimation |
1024
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Kernel alignment (0-1) |
Example
alignment = kernel.kernel_alignment(X, y) print(alignment)
Source code in psiqit\qml\quantum_kernel.py
get_feature_map_circuit(x)
Get the feature map circuit for a data point
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
Feature vector |
required |
Returns:
| Name | Type | Description |
|---|---|---|
QuantumCircuit |
QuantumCircuit
|
Feature map circuit |
Example
circ = kernel.get_feature_map_circuit(x) print(circ.draw())
Source code in psiqit\qml\quantum_kernel.py
get_state(x)
Get the quantum state for a data point
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
Feature vector |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Ket |
Ket
|
Quantum state |
Example
state = kernel.get_state(x) print(state)
Source code in psiqit\qml\quantum_kernel.py
QuantumKernelEstimator
Quantum Kernel Estimator using the SWAP test
Estimates the kernel (fidelity) between two quantum states using the SWAP test circuit.
Example
from psiqit.qml import QuantumKernelEstimator estimator = QuantumKernelEstimator(n_qubits=2) state1 = Ket([1, 0, 0, 0]) state2 = Ket([0, 1, 0, 0]) fidelity = estimator.swap_test(state1, state2) print(fidelity)
Source code in psiqit\qml\quantum_kernel.py
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | |
__init__(n_qubits)
Initialize Quantum Kernel Estimator
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_qubits
|
int
|
Number of qubits |
required |
Source code in psiqit\qml\quantum_kernel.py
swap_test(state1, state2, shots=1024)
Estimate fidelity between two states using the SWAP test
The SWAP test estimates |⟨ψ|φ⟩|² by measuring the probability of the ancilla qubit being in the |0⟩ state.
P(ancilla=0) = (1 + |⟨ψ|φ⟩|²) / 2
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state1
|
Union[Ket, ndarray]
|
First quantum state |
required |
state2
|
Union[Ket, ndarray]
|
Second quantum state |
required |
shots
|
int
|
Number of measurements |
1024
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Estimated fidelity (0-1) |
Example
state1 = Ket([1, 0]) state2 = Ket([1/np.sqrt(2), 1/np.sqrt(2)]) fidelity = estimator.swap_test(state1, state2) print(fidelity) # 0.5
Source code in psiqit\qml\quantum_kernel.py
kernel_matrix_swap(states, shots=1024)
Compute kernel matrix using SWAP test
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
states
|
List[Ket]
|
List of quantum states |
required |
shots
|
int
|
Number of shots for each pair |
1024
|
Returns:
| Type | Description |
|---|---|
List[List[float]]
|
List[List[float]]: Kernel matrix |
Example
states = [state1, state2, state3] K = estimator.kernel_matrix_swap(states) print(K)
Source code in psiqit\qml\quantum_kernel.py
estimate_kernel(x1, x2, feature_map, shots=1024)
Estimate kernel using a feature map and SWAP test
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
ndarray
|
First feature vector |
required |
x2
|
ndarray
|
Second feature vector |
required |
feature_map
|
Callable
|
Feature map function that takes data and returns a circuit |
required |
shots
|
int
|
Number of shots |
1024
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Estimated kernel value |
Example
def fm(x): ... circ = QuantumCircuit(2) ... circ.ry(0, x[0] * np.pi) ... circ.ry(1, x[1] * np.pi) ... return circ kernel = estimator.estimate_kernel(x1, x2, fm)
Source code in psiqit\qml\quantum_kernel.py
info()
Get information about the quantum machine learning module
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Module information |
Source code in psiqit\qml\__init__.py
test()
Run basic tests for the quantum machine learning module
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Test results |