Giter Site home page Giter Site logo

pytorch_time2vec's Introduction

pytorch_time2vec

This repository contains a Pytorch implementation of the Time2Vec Algorithm [1]. It makes use of the Punta Salute 2009 dataset (historical levels of water in Venice) as in [2]. The dataset shows the hourly water level (cm). Furthermore, we have followed the analysis provided in [2] and thus a Bootstrapping script can be found in the current repository.

Code organization

  • main.py - Implements a simple time series prediction training and testing example on the Livelo dataset.
  • analysis.py Implements a Bootstrapping and estimates the distributions of the samples on the test dataset.
  • model/network.py Implements an LSTM and an LSTM equipped with a Time2Vec layer
  • model/time2vec Implents the Time2Vec layer
  • data/livelo.npy Raw dataset of Punta Salute 2009

Example of usage

The time2vec layer can be used at will. In this repository, we provide a simple example of how to use it along with an LSTM to predict the hourly water level of Venice based on historical data (2009).

To run the simple LSTM model type in:

$ python (or python3 depending on your system`s configuration) main.py --model lstm 

And to run the T2V-LSTM:

$ python main.py --model tv-lstm

When you run either of the two aforementioned examples the script will store the results of the test prediction to the directory results (you will need to create this directory before running the main.py script).

If you'd like to run the Bootstrapping to get the distributions of the test predictions you can run the analysis.py script (this script requires the results of the test predictions for both LSTM and T2V-LSTM models).

$ python analysis.py

You can control more parameters such as the number of epochs or batches and the length of the learned sequence by passing command line arguments to the main.py script.

Requirements

  • Python 3
  • Numpy
  • Matplotlib
  • Pytorch

Platform specifications

The current implementation has been tested and ran on the following software configuration:

  • GCC 8.3.0
  • Ubuntu Linux 5.3.0-40-generic
  • Python 3.6.9
  • Numpy 1.18.2
  • Matplotlib 3.1.1
  • Pytorch 1.4.0 (No GPU)

References

[1] "Time2Vec: Learning a vector representation of time", Kazemi et al., 2019

[2] Time2Vec for Time Series features encoding

pytorch_time2vec's People

Contributors

gdetor avatar

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.