Skip to main content

TimeDiffusion - Unified Framework for Multiple Time Series Tasks

Supports 2D (image) and 3D (video) data as input for research purposes.

Contents

Install

pip install timediffusion

Quick Start

Forecasting time series

# train sequence in shape [channels, sequence_length]
model = TD(input_dims=train.shape).to(device=device)
training_losses = model.fit(train)
# horizon : int - how many future values to forecast
predictions = model.forecast(horizon)

Creating synthetic time series

# sequence in shape [channels, sequence_length]
model = TD(input_dims=seq.shape).to(device=device)
training_losses = model.fit(seq)
# proximity - how close to original, samples - total synthetic time series
synthetic_data = model.synth(proximity=0.9, samples=3, batch_size=2, step_granulation=10)

Time series Imputation

# sequence in shape [channels, sequence_length]
model = TD(input_dims=seq.shape).to(device=device)
# mask - binary array of same shape, as sequence, with 1 in positions, that are unknown
training_losses = model.fit(seq, mask=mask)
restored_seq = model.restore(example=seq, mask=mask)

Examples

Time series: multiple tasks example

Forecasting bitcoin price example

Philosophy

Main synopsis behind TimeDiffusion model is that in reality, when working with time series we don’t have many samples, as it could be in other machine learning fields (e.g. cv, nlp). Thus, classical autoregressive approaches like ARIMA has the most suitable approach of fitting / training only on original sequence (maybe with some exogenous data).

TimeDiffusion takes inspiration from these established methods and only trains on the input sample. Model incorporates most powerful modern deep learning techniques such as diffusion process, exponential dilated convolutions, residual connections and attention mechanism (in one of the versions)

Base Models

  • TimeDiffusionProjector - exponential dilated convolutions + residual connections.

Currently main model in use

  • TimeDiffusionAttention - attention mechanism on top of TimeDiffusionProjector (q, k, v) projectors.

Currently not viable

  • TimeDiffusionLiquid - exponential dilated convolutions with shared middle convolutional layer weight.

Lightweight, fast, but less accurate than the main model.

Model architecture

Presented below are diagrams depicting model components, each new scheme representing a higher level of abstraction.

  • Temporal Block

Temporal Block Architecture image

  • TimeDiffusionProjector

TimeDiffusionProjector Architecture image

  • TimeDiffusionAttention

TimeDiffusion Architecture image

Metadata

Release files for timediffusion 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for timediffusion 0.4.1
File Size Uploaded
timediffusion-0.4.1.tar.gz 13.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for timediffusion 0.4.1
File Interpreter ABI Platform
timediffusion-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 26.5 kB

Release files / timediffusion-0.4.1.tar.gz

Download URL timediffusion-0.4.1.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
fe437f4029c428d6acb77426f651437332aa2d674f07ca4be45c42858bdd2f9d
BLAKE2b-256 checksum
How to use checksums
2ba98dc79ab2b46d88c3254e2c8bb699ead0a7196252bf8534903c685dadbc27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / timediffusion-0.4.1-py3-none-any.whl

Download URL timediffusion-0.4.1-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc27aa1855f852025f29d1ebda0ec3c82f1443898ea268d0210286d62d4f35b0
BLAKE2b-256 checksum
How to use checksums
44f091709cda29f8c6231de5d37fa0f08df01e814430ea191a74c126a63ef61d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

0.4

2 release files

0.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page