Code Monkey home page Code Monkey logo

rnn_timeseries-forecast's Introduction

Recurrent Neural Network for Time Series Forecasting


This is a time series forecasting project based on the Wikipedia Web Traffic Time Series Forecasting dataset from Kaggle. Two RNN architectures are implemented:

  • A "Vanilla" RNN regressor.
  • A Seq2seq regressor.

Both are implemented in TensorFlow 2, with custom training functions optimized with Autograph.

Structure of the repository

Main files:

  • config.yaml: config file for hyperparameters.
  • dataprep.py: data preprocessing pipeline.
  • train.py: training pipeline.
  • tools.py: contains useful processing functions to be iterated in main pipelines.
  • model.py: builds model.

I also added a visualize_performance.ipynb Jupyter Notebook to visually inspect models' performance on Test data.

Folders:

  • /data_raw/: requires unzipped train_2.csv file from Kaggle. Available is an imputed.csv dataset, containing imputed time series, coming from my other repository on a GAN for imputation of missing data in time series.
  • /data_processed/: divided in /Train/ and /Test/ directories.
  • /saved_models/: contains all saved TensorFlow models, both regressors.
  • /utils/: for pics and other secondary files.

How to run code

After you clone the repository locally, download the raw dataset from Kaggle, and place unzipped train_2.csv file in /data_raw/ folder. Then, time series forecast is executed in two steps. First, run data preprocessing pipeline:

python -m dataprep

This will generate Training+Validation and Test files, stored in /data_processed/ subdirectories. Second, launch training pipeline with:

python -m train

This will either create, train and save a new model, or load and train an already existing one, stored in /saved_models/ folder.

Finally, Test set performance will be evaluated from test.ipynb notebook.

Modules

numpy==1.18.3
pandas==1.0.3
scikit-learn==0.22.2.post1
scipy==1.4.1
tensorflow==2.1.0
tqdm==4.45.0

Hardware

I used a pretty powerful laptop, with 64GB or RAM and NVidia RTX 2070 GPU. I highly recommend GPU training to avoid excessive computational times.

rnn_timeseries-forecast's People

Contributors

ivanbongiorni avatar

Stargazers

 avatar

Watchers

 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.