Skip to main content

Tools for testing quantum and classical adapter heads in time-series forecasting experiments

Project description

Q-TimesFM

Q-TimesFM is a small research package for testing hybrid quantum-classical adapter heads on top of frozen time-series forecasting backbones.

The current code focuses on practical experiments: loading a CSV, building sliding windows, training a lightweight adapter head, and comparing it with a matched classical bottleneck. It is not a replacement for TimesFM, and it does not make any claim of quantum advantage.

Status

This is an alpha research prototype. APIs may change while the experiments are being tightened up.

Installation

After the package is published:

pip install q-timesfm

For local development:

pip install -e ".[dev,lightning,yaml]"

The lightning extra installs PennyLane Lightning support. GPU execution still depends on a compatible NVIDIA driver, CUDA, and cuQuantum stack.

Draw the Quantum Circuit

q-timesfm-draw-circuit \
  --n-qubits 6 \
  --quantum-depth 2 \
  --output circuit.png

Use --pennylane-device lightning.qubit when PennyLane Lightning is available.

Train on a CSV File

Single-series example:

q-timesfm-train \
  --data-source generic_csv \
  --csv-path your.csv \
  --target-col value \
  --time-col date \
  --context 32 \
  --horizon 8 \
  --head-type classical_bottleneck \
  --epochs 1 \
  --batch-size 8 \
  --backend torch

Grouped time series are supported with --group-col. Windows are built within each group and never cross group boundaries:

q-timesfm-train \
  --data-source generic_csv \
  --csv-path your.csv \
  --target-col value \
  --time-col date \
  --group-col series_id \
  --context 32 \
  --horizon 8 \
  --head-type quantum \
  --backend pennylane \
  --pennylane-device lightning.qubit

CSV Format

Minimum single-series format:

date,value
2020-01-01,1.0
2020-01-02,1.2

Grouped format:

series_id,date,value
A,2020-01-01,1.0
A,2020-01-02,1.2
B,2020-01-01,5.0

TimesFM Checkpoints

Pretrained TimesFM checkpoints are not bundled with this package. If you use the TimesFM adapter wrapper, point the code to a local checkpoint and make sure the upstream TimesFM package or source tree is available in your environment.

Python API

from q_timesfm import make_generic_dataset, train_adapter

X, y, meta, info = make_generic_dataset(
    "your.csv",
    target_col="value",
    time_col="date",
    context=32,
    horizon=8,
)

result = train_adapter(
    data_source="generic_csv",
    csv_path="your.csv",
    target_col="value",
    time_col="date",
    head_type="classical_bottleneck",
    context=32,
    horizon=8,
    epochs=1,
    backend="torch",
)

Notes

  • The package is intended for controlled experiments, not production forecasts.
  • Quantum results should be compared against matched classical baselines.
  • Report negative results; they are useful for this line of work.
  • Do not interpret early runs as evidence of quantum advantage.

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

q_timesfm-0.1.0.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

q_timesfm-0.1.0-py3-none-any.whl (42.0 kB view details)

Uploaded Python 3

File details

Details for the file q_timesfm-0.1.0.tar.gz.

File metadata

  • Download URL: q_timesfm-0.1.0.tar.gz
  • Upload date:
  • Size: 27.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for q_timesfm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f7e959b0bbdbf4ff1e282ffe6c8c1fa19938837ab3144c5df165560d307392c9
MD5 08cd63666d5f510653f5f9de76c6ed7d
BLAKE2b-256 426d9e09a7c25b79a6af1c7d7847704713ad7404fc449a6f65518559d91aa57b

See more details on using hashes here.

File details

Details for the file q_timesfm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: q_timesfm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 42.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for q_timesfm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b92a93f7098d2f77860f5b5af84450a7918d7bd3151c045212e816d0dc00c96
MD5 250b2a6e5c4fe25ac545f7f613a539fb
BLAKE2b-256 8772a6657b48ea84c5aee5e2b464139a66eaa561f15b80b3cc1c346ed5444c08

See more details on using hashes here.

Supported by

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