A PyTorch implementation of Quantum Weight Re-Mapping
Project description
qW-Map: Weight Re-Mapping for Variational Quantum Circuits
A PyTorch implementation of Quantum Weight Re-Mapping
In recent years, quantum machine learning has seen a substantial increase in the use of variational quantum circuits (VQCs). VQCs are inspired by artificial neural networks, which achieve extraordinary performance in a wide range of AI tasks as massively parameterized function approximators. VQCs have already demonstrated promising results, for example, in generalization and the requirement for fewer parameters to train, by utilizing the more robust algorithmic toolbox available in quantum computing. A VQCs' trainable parameters or weights are usually used as angles in rotational gates and current gradient-based training methods do not account for that. We introduce weight re-mapping for VQCs, to unambiguously map the weights to an interval of length $2\pi$, drawing inspiration from traditional ML, where data rescaling, or normalization techniques have demonstrated tremendous benefits in many circumstances. We employ a set of five functions and evaluate them on the Iris and Wine datasets using variational classifiers as an example. Our experiments show that weight re-mapping can improve convergence in all tested settings. Additionally, we were able to demonstrate that weight re-mapping increased test accuracy for the Wine dataset by $10%$ over using unmodified weights.
Implemented Functions
Install
$ pip install qw-map
Example:
import pennylane as qml
from qw_map import tanh
from torch import Tensor
def circuit(ws: Tensor, x: Tensor):
qml.AngleEmbedding(x, rotation='X', wires=range(num_qubits))
qml.StronglyEntanglingLayers(tanh(ws), wires=range(num_qubits))
Citation
TODO
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file qW-Map-0.1.2.tar.gz
.
File metadata
- Download URL: qW-Map-0.1.2.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54aca84be8d32ff659d10b5cf382e4d80cc426a1c16d53379a763bc25a1b73f1 |
|
MD5 | ba467696f21d3e220ad6209b2549e7fd |
|
BLAKE2b-256 | 864119d39f63f04f1836917873b4a25d09fe97807b04ba920840b06656432a5e |
File details
Details for the file qW_Map-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: qW_Map-0.1.2-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06da406a99c448b93d261303b08029758288e61a4b9c85359211a8253235a5dc |
|
MD5 | 96ec3a9950d8ef52bfb65e412b9654ca |
|
BLAKE2b-256 | 406a90bf71c8f2e8a14702a2890d2e535bd990f0801b8e70171e30aca235b07b |