This is an Implmentation of a Recurrent Neural Network using LSTM's. Here I have used the model to train it on Stock Price History data as well as World News data from Reddit. We use daily world news headlines from Reddit to predict the opening value of the Dow Jones Industrial Average. The data for this project comes from a dataset on Kaggle, and covers nearly eight years (2008–08–08 to 2016–07–01). I have used GloVe’s larger common crawl vectors to create our word embeddings and Keras to build our model. This model was inspired by the work described in the mentioned paper. Similar to the paper, we will use CNNs followed by RNN with LSTM's ( not GRU's), and also various articles and blogs mentioned below. To help construct a better model, we will use a grid search to alter our hyperparameters’ values and the architecture of our model.
Requirements:
- Python 3 or above
- TF 1.3 or Above
- Keras
- Pandas
- Numpy
- NLTK
- SKLearn
- MatPlotLib
- Glove v1.2 Word Embeddings
Data Sources:
- Glove : https://nlp.stanford.edu/projects/glove/
- Stock and News Data : https://www.kaggle.com/aaron7sun/stocknews
Steps:
- Import Dependencies
- Read and Preprocess data
- Load contractions, clean and aggregate news text
- Create word count library
- Load GloVe's Embeddings
- Match our vocab to gloVes vectors
- Split Testing and Training data
- Define placeholders and build Sequential RNN model with conditionals for grid search extension
- Train the model using model.fit and and use grid search to find the best model and save it.
- Make Predictions with the best weights
All steps have been described and implemented in the Jupyter Notebook
Reference Links:
- https://machinelearningmastery.com/time-series-prediction-lstm-recurrent-neural-networks-python-keras/
- https://medium.com/@TalPerry/deep-learning-the-stock-market-df853d139e02
- https://medium.com/machine-learning-world/neural-networks-for-algorithmic-trading-2-1-multivariate-time-series-ab016ce70f57
- https://machinelearningmastery.com/time-series-prediction-with-deep-learning-in-python-with-keras/
- https://www.youtube.com/watch?v=ftMq5ps503w
- https://machinelearningmastery.com/multivariate-time-series-forecasting-lstms-keras/
- https://medium.com/@Currie32/predicting-the-stock-market-with-the-news-and-deep-learning-7fc8f5f639bc
- https://www.kaggle.com/marklam/a-neutral-network-to-read-btc-price-action
Research Papers: 0. https://www.aclweb.org/anthology/C/C16/C16-1229.pdf - Combination of Convolutional and Recurrent Neural Network for Sentiment Analysis of Short Texts
- http://www.aclweb.org/anthology/D14-1162 - GloVe: Global Vectors for Word Representation
- https://people.cs.pitt.edu/~hashemi/papers/CISIM2010_HBHashemi.pdf - Stock Market Value Prediction Using Neural Networks
- https://www.hindawi.com/journals/cin/2016/4742515/ - Financial Time Series Prediction Using Elman Recurrent Random Neural Networks
- ftp://ftp.idsia.ch/pub/juergen/icann2001predict.pdf - Applyling LSTM to TS Predictable through Time Window Approachs
- ftp://ftp.idsia.ch/pub/juergen/L-IEEE.pdf - LSTM and RNN Simple Context Free and Sensitive Language