To predict various stock market parameters (Open Price, High Price, Low Price, Last Price, Close Price, Average Price) using the LSTM/GRU model and predict Day1-Day2-Day3 forecast of 5 more companies and evaluate its performance.
While Gated Recurrent Units (GRU) use lesser training paramaters (therefore, lesser memory), and are faster than Long Short-Term Memory Networks (LSTM), LSTM networks have a higher accuracy. As for this project, accuracy is more important than run-time, LSTM networks have been used for forecasting.
- Numpy
- Matplotlib
- Pandas
- Sklearn
- Keras
- Tensorflow
Environment- Python 3.7.3, Windows 10
The code was developed on Google Colab.
National Stock Exchange India was referred to obtain company-wise data of 12 Fortune 500 India companies.
The companies used for training are-
- Bombay Dyeing and Manufacturing
- Bosch
- Britannia
- Coal India
- Hindustan Construction Company
- Hindustan Unilever
- Mahindra and Mahindra Financial Services
- Nestle
- Oracle Financial Services Software
- Reliance Industries
- State Bank of India
- Whirlpool of India
The network contains 5 LSTM layers, and a dense layer in the end containing 6 units (to predict 6 parameters). Adam optimizer Mean Squared Error have been used for training for 100 epochs.
The model was tested on 5 Fortune 500 India companies-
- Raymond
- Indian Oil Corporation
- Bharat Electronics
- Steel Authority of India Limited (SAIL)
- Spice Jet
Mean Absolute Error (L1 error) has been used for quantitative evaluation of the results.
It can be observed that the model gives moderately high error. This could be because of the different variations in the stock prices of the companies with respect to time. Accordingly, the model can be improved for better performance.