Skip to content

A straightforward implementation of NBeats with RevIN normalization-denormalization for univariate time-series data. (Easily extensible to multivariate)

Notifications You must be signed in to change notification settings

tharunsuresh-code/NBeats_with_RevIN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NBeats with RevIN implementation

To implement NBeats with RevIN normalization layer for univariate Time Series datasets.

This repo provides an implementation of the N-Beats model with RevIN normalization.
N-Beats - [Paper] [GitHub]
RevIN - [Paper] [GitHub]

1.png 6.png
12.png 28.png

Note: This repo uses a variant of N-Beats implementation as provided in this link.

Environment

This code was tested in python 3.9.

Quick Start

  1. Install PyTorch == v.1.12.0 (tested) following the official instruction
  2. Install the required libraries from requirements.txt.
pip install -r requirements.txt
  1. Download the file "RevIN.py" from RevIN and place in model/ folder.
  2. Run the following command to train and infer NBeatsRevin model on all files in "data_path" folder.
python run.py -data_path dataset -out_path output -batch_size 512

Command-line arguments

  • data_path - path to the dataset folder (default: dataset)
  • out_path - path to the outputs folder to save output plots, and test score csv (default: output)
  • save_path - path to save the trained pytorch model for each dataset (default: save)
  • save - flag to enable saving trained pytorch models (default: false)
  • batch_size - set the batch size of training dataset (default: 256)
  • n_epochs - number of epochs to train the model upon (default: 1500)
  • random_seed - seed to set for pytorch for reproducibility (default: 42)

Repository Structure

Model

PyTorch implementation of N-Beats with RevIN normalization can be found in model/NBeatsRevin.py

Datasets

A few sample univariate time series datasets can be found in dataset/*.csv. (I am not able to provide data of sample plots above due to ownership issues, but you can find plenty of datasets online)

Experiment

run.py consists of the requisite code to train and infer the time series datasets. The python script trains the model on all files in the data_path argument, saves prediction plots and test scores in out_path argument. Optionally, the trained pytorch model can be saved using save_path command line argument.

About

A straightforward implementation of NBeats with RevIN normalization-denormalization for univariate time-series data. (Easily extensible to multivariate)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages