Forecasting of stock market is a way to predict future prices of stocks. The Stock prices are dynamic day by day, so it is hard to decide what is the best time to buy and sell stocks. It is a long time attractive topic for researcher and investors from its existence. Machine Learning provides a wide range of algorithms, which has been reported to be quite effective in predicting the future stock prices. In this project, we explored different data mining algorithms to forecast stock market prices for NSE stock market. Our goal is to compare various algorithms and evaluate models by comparing prediction accuracy. We examined a few models including Linear regression, Arima, LSTM, Random Forest and Support Vector Regression. Based on the accuracy calculated using RMSE of all the models, we predicted prices of different industries. For forecasting, we used historical data of NSE stock market and applied a few preprocessing methods to make prediction more accurate and relevant.
Dataset was taken from here and includes India stocks and our index covers a diverse set of sectors featuring many indian companies.
- Clone the project.
- Download the dataset and preprocessed dataset from here.
- Install Jupyter Notebook.
- Install required libraries:
$ pip install numpy
$ pip install pandas
$ pip install scipy
$ pip install keras
$ pip install matplotlib
$ pip install seaborn
Following algorithms are used for time series analysis:
- Linear regression
- Support Vector Regression (SVR)
- Long Short Term Memory (LSTM)
- Autoregressive Integrated Moving Average (ARIMA)
- Random Forest
For 1 company (3IINFOTECH)
- Algorithms compared using RMSE calculated for each model.
- LSTM and Arima model gave lowest RMSE and highest accurate prediction. So these are winning algorithms.
- SVR gave highest RMSE.