Quantum-Based Image Encoding of Time Series
Project description
QTS2D: Quantum-Based Image Encoding of Time Series
QTS2D is a Python library for encoding time series data into image representations using quantum computing principles. These image-based representations can then be used as input for various machine learning models, particularly Convolutional Neural Networks (CNNs), for tasks like time series classification or forecasting.
Description
The library provides several quantum-inspired transformers that convert 1D time series into 2D matrices (images). These methods are analogous to classical time series imaging techniques but leverage quantum computations or quantum-inspired mathematical formulations.
Currently implemented transformers:
- QGAF: Quantum Gramian Angular Field
- QRP: Quantum Recurrence Plot
- QSG: Quantum Spectrogram
- QMTF: Quantum Markov Transition Field
Installation
You can install library using pip:
pip install qts2d
or using pip+git for the latest version of the code:
pip install git+
The library requires Python >= 3.10 and the following main dependencies:
- numpy (>=2.2.5)
- scikit-learn (>=1.6.1)
- qiskit (==1.4.2)
- qiskit-aer (==0.17.0)
- qiskit-machine-learning (==0.8.2)
- pyts (>=0.13.0)
Quick Example
Each transformer follows the scikit-learn Estimator and TransformerMixin interface.
import numpy as np
from qts2d.encoding import QGAF
# Example time series data (n_samples, n_timestamps)
X = np.random.rand(1, 1000)
# Using Quantum Gramian Angular Field (QGAF)
qgaf = QGAF(image_size=32, method='summation', computation_method='hadamard', scaling='minmax')
X_qgaf = qgaf.fit_transform(X)
print(f"QGAF output shape: {X_qgaf.shape}")
For more detailed examples, please refer to the examples/ directory for each specific transformer. To run the examples Matplotlib is required.
Contributing
We welcome everyone to contribute to qts2d! The library is still evolving and far from perfect, so your help is especially valuable. Please feel free to submit a pull request or open an issue. Detailed contribution guidelines will be shared soon along with the documentation. Stay tuned!
Citation
Coming soon!
License
This project is licensed under the BSD 3-Clause License - see the LICENSE.txt file for details.
References
-
[1] Xu, Z., Wang, Y., Feng, X., Wang, Y., Li, Y., & Lin, H. Quantum-enhanced forecasting: Leveraging quantum gramian angular field and CNNs for stock return predictions. Finance Research Letters (2024)
-
[2] Z. Wang and T. Oates, "Encoding Time Series as Images for Visual Inspection and Classification Using Tiled Convolutional Neural Networks." AAAI Workshop (2015).
-
[3] J.-P Eckmann, S. Oliffson Kamphorst and D Ruelle, "Recurrence Plots of Dynamical Systems". Europhysics Letters (1987).
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qts2d-0.1.0.tar.gz.
File metadata
- Download URL: qts2d-0.1.0.tar.gz
- Upload date:
- Size: 55.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7c1cf9d1871eb6e339b828d72ea1cbaa6ff9b32bce0d153aa493d5deadca932
|
|
| MD5 |
a801dc120742b8af01ef0137180dd82b
|
|
| BLAKE2b-256 |
d488498f78064e5ce61a312c26a2a6dd4424c577f77e861ff40c8f7739cca693
|
Provenance
The following attestation bundles were made for qts2d-0.1.0.tar.gz:
Publisher:
publish_pypi.yml on sokolmarek/qts2d
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qts2d-0.1.0.tar.gz -
Subject digest:
e7c1cf9d1871eb6e339b828d72ea1cbaa6ff9b32bce0d153aa493d5deadca932 - Sigstore transparency entry: 208556807
- Sigstore integration time:
-
Permalink:
sokolmarek/qts2d@8086b9b682315a0c636f2d36c60244ee4cb221af -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/sokolmarek
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_pypi.yml@8086b9b682315a0c636f2d36c60244ee4cb221af -
Trigger Event:
release
-
Statement type:
File details
Details for the file qts2d-0.1.0-py3-none-any.whl.
File metadata
- Download URL: qts2d-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74932fff0367cbf7a47d5e94395512e086772d69e539c99d5081059aa907c57d
|
|
| MD5 |
84c7aea64097e43357daf522579bbf89
|
|
| BLAKE2b-256 |
08b0d6752cb6cda8f3fe88891f2585197204e4da97cc2ff9374ceda2b139361c
|
Provenance
The following attestation bundles were made for qts2d-0.1.0-py3-none-any.whl:
Publisher:
publish_pypi.yml on sokolmarek/qts2d
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qts2d-0.1.0-py3-none-any.whl -
Subject digest:
74932fff0367cbf7a47d5e94395512e086772d69e539c99d5081059aa907c57d - Sigstore transparency entry: 208556813
- Sigstore integration time:
-
Permalink:
sokolmarek/qts2d@8086b9b682315a0c636f2d36c60244ee4cb221af -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/sokolmarek
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_pypi.yml@8086b9b682315a0c636f2d36c60244ee4cb221af -
Trigger Event:
release
-
Statement type: