Stock Price Prediction using Artificial Intelligence

Part A

Problem Statement

Our goal is to predict stock price using Neural network, Long-Short Term Memory(LSTM) and Convolutional Neural Networks(CNN). In this implementation, the input to the system is a stock price dataset of company that consists of high, low, open and close numerical values. The output is close value predicted.

Methodology

As you can see from the below diagram, for Fully-Connected Neural Networks we are predicting the Stock price by splitting the data into train and test respectively. For LSTM and CNN model, we are predicting every 8th record based on the previous 7 days data. For example, the 8th record is predicted based on the previous 7 days data. The 9th record is predicted based on the data from 2nd to 8th record and so on.

Experimental results and Analysis

Below table captures the best results of all models that are implemented for stock price prediction. We have tried using different hyperparameters to implement the models efficiently.

We observed that CNN model was faster and more accurate in implementation than LSTM model. The RMSE for CNN is less than LSTM.

Observations with different combinations of activation function, optimizer and Kernel size:

ipython notebook

Part B

Additional Features (Extension of Part A)

1. Predicting data for future days: For each future day prediction, we add predicted values with the original set of values to predict next day.

2. Gated Recurrent Unit (GRU): It is improved version of Standard Recurrent Neural Network.

Process

1. Predicting data for future days: For this feature we input number of future days to a function we want to predict. First only one day is predicted using pre-trained LSTM model. These predicted values are normalized and added to the original set to predict next day. Process continues until number of future days.

2. GRU: For GRU, we are using the same Hyperparameters as used in LSTM model.

ipython notebooks for both additional features

Observations

1. Predicting data for future days:
  a. Using normalized x values and y as original values from csv file we get RMSE in thousands


2. GRU: Below table shows the RMSE difference between two models. As seen from the table below, RMSE for GRU is greater than RMSE for LSTM model. Also, the GRU model takes longer to run 1 epoch as compared to LSTM.