Git Product home page Git Product logo

predicting-financial-time-series-data-by-using-neural-network's Introduction

Predicting-Financial-Time-Series-Data-by-using-Neural-Network

In this project, we aim to predict the close price of sp500 index based on the previous 22 days from year 1950 - 2017.

This work is based on BenjiKCF's work. This result is much better since the models are optimized.

There are 2 models. Neural network and lstm-rnn.

  • Filename: NN_ClosePrice_prediction.ipynb

  • Filename: LSTM_ClosePrice_prediction.ipynb

NN model result

Alt text

Train Score: 0.00003 MSE (0.00574 RMSE)

Test Score: 0.00009 MSE (0.00934 RMSE)

LSTM model result

Train Score: 0.00001 MSE (0.00325 RMSE)

Test Score: 0.00006 MSE (0.00765 RMSE)

Alt text

LSTM has better result than regular Neural network

Future improvement:

  1. Sentiment analysis will be added as features
  2. More indexes and stocks will be included

Some Notes

  1. CuDNNLSTM is much faster than LSTM, in my experience, it's around 5x.
  2. Predicting close price is very challenging, both complex model are beaten by naive prediction.

How to set up the environment and train the model

I suggest using virtualenvwrapper, then this project will not affect others

  • Set up a virtualenv with python3 (same for python2)

mkvirtualenv --python=/usr/bin/python3 nameOfyourEnvironment

workon nameOfyourEnvironment

  • Install all the requirements

pip install -r requirements.txt

  • Install tensorflow and keras with gpu enabled

pip install tensorflow-gpu

pip install keras

  • Setup ipykernel

pip install ipykernel

python -m ipykernel install --user --name=nameOfyourEnvironment

  • Open jupyter notebook, choose nameOfEnvironment kernel

predicting-financial-time-series-data-by-using-neural-network's People

Contributors

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