Git Product home page Git Product logo

timetoai / timediffusion Goto Github PK

View Code? Open in Web Editor NEW
21.0 2.0 1.0 2.09 MB

Unified Framework for Multiple Time Series Tasks

License: MIT License

Python 100.00%
deep-learning deep-neural-networks framework machine-learning machine-learning-algorithms multi-task multi-task-architecture multiple-tasks open-source pypi-package python python3 pytorch pytorch-implementation time-series time-series-forecasting time-series-imputation time-series-prediction time-series-simulation data-science

timediffusion's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.