Giter VIP home page Giter VIP logo

wavenet-btc's Introduction

WaveNet-BTC

This repository contains an implementation of the WaveNet model used for time series forecasting, particularly on intra-day Bitcoin exchange data.

The general architecture used for this implementation was taken from:

(1) Conditional Time Series Forecasting with Convolutional Neural Networks

The original WaveNet paper:

(2) WaveNet: A Generative Model for Raw Audio - GitHub

Also some code was used from the Fast WaveNet model:

(3) Fast Wavenet Generation Algorithm - GitHub

The model was run on only indavidual day's data at a time at 1-minute resolution. The model was fit on data up to 6pm, then generated a dynamic forecast forward for the rest of the day. Sample foecast on the most recent day in the data set (additional samples can be found in the /images folder):

Coinbase Price on 2017-10-19 by minute

Setup and Requirements

Python 2.7 (The only portion of the code incompatible with Python 3 is the use of dict.iteritems() instead of dict.items())

Packages:

  • Numpy
  • Pandas
  • TensorFlow
  • Matplotlib
  • Mpld3 (optional, used to make the plots interactive)

Download the Bitcoin Historical Data and unzip it into the ./data folder. The data can be found here: Bitcoin Historical Data - Kaggle

Model

The network is very close to what is described in (1). It uses a causal, conditional input layer with parameterized skip connections, followed by a stack of dilated convolutions (filter size 2, dilation of 2^l) each with a residual connection similar to ResNet, and finally the output is generated by a 1x1 convolution. For this example, we use 7 convolution layers (resulting in a receptive field of 128 time steps or ~2 hours). The rest of the parameters can be found in the "Run Model.ipynb" notebook.

TensorBoard Render

The key to this implementation that there are actually 3 parallel WaveNet networks being used, one for the exchange rate from each of 3 different exchanges: Coinbase, Coincheck, and Bitstamp. Each of these networks is trained on predicting the price for a given exchange, based on the past prices of that exchange and conditioned on the past prices of the other two exchanges. These three networks can be trained asynchronously since all historical data is known.

TensorBoard Render

At generation time, the networks are coupled together such that each model will forecast a single time step t+1, then these three predictions will be fed back into each of the 3 models to make dynamic forecasts. By training a separate network for each feature, we can make arbitrary out-of-sample forecasts into the future, and maintain the multivariate time series.

TensorBoard Render

wavenet-btc's People

Contributors

kykosic avatar

Watchers

Harry 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.