Skip to main content

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

drawing 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.

Arxiv Paper

Implemented Functions

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qW-Map-0.1.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

qW_Map-0.1.1-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file qW-Map-0.1.1.tar.gz.

File metadata

  • Download URL: qW-Map-0.1.1.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for qW-Map-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1e7bd35d431381692029d6275add4fe5072ed2664af18ea880ef33643fe2a134
MD5 0b64a0fd115bfaced2b267ab7e0bccf3
BLAKE2b-256 c9b3e1f49b779f39b8b0f7e36842c660e8e99ab2b369117949760a9d2dc4465e

See more details on using hashes here.

File details

Details for the file qW_Map-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: qW_Map-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for qW_Map-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f2ae0c61235a91060d1499d86523c0f7a49333d0b851ebbc8aec793785e63faf
MD5 193159e10017c4746266087302ba59fa
BLAKE2b-256 8b5019ab8a11e8ac9345b147b84aaa8e5a77b23e04f491724a8b476cb03985e9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page