Skip to main content

Stock Price Prediction Using Machine Learning and LSTM-Based Deep Learning Models

  • Conference paper
  • First Online:
Machine Learning and Metaheuristics Algorithms, and Applications (SoMMA 2020)

Part of the book series: Communications in Computer and Information Science ((CCIS,volume 1366))

Abstract

Prediction of stock prices has been an important area of research for a long time. While supporters of the efficient market hypothesis believe that it is impossible to predict stock prices accurately, there are formal propositions demonstrating that accurate modeling and designing of appropriate variables may lead to models using which stock prices and stock price movement patterns can be very accurately predicted. Researchers have also worked on technical analysis of stocks with a goal of identifying patterns in the stock price movements using advanced data mining techniques. In this work, we propose an approach of hybrid modeling for stock price prediction building different machine learning and deep learning-based models. For the purpose of our study, we have used NIFTY 50 index values of the National Stock Exchange (NSE) of India, during the period December 29, 2014 till July 31, 2020. We have built eight regression models using the training data that consisted of NIFTY 50 index records from December 29, 2014 till December 28, 2018. Using these regression models, we predicted the open values of NIFTY 50 for the period December 31, 2018 till July 31, 2020. We, then, augment the predictive power of our forecasting framework by building four deep learning-based regression models using long-and short-term memory (LSTM) networks with a novel approach of walk-forward validation. Using the grid-searching technique, the hyperparameters of the LSTM models are optimized so that it is ensured that validation losses stabilize with the increasing number of epochs, and the convergence of the validation accuracy is achieved. We exploit the power of LSTM regression models in forecasting the future NIFTY 50 open values using four different models that differ in their architecture and in the structure of their input data. Extensive results are presented on various metrics for all the regression models. The results clearly indicate that the LSTM-based univariate model that uses one-week prior data as input for predicting the next week’s open value of the NIFTY 50 time series is the most accurate model.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Sen, J., Datta Chaudhuri, T.: An alternative framework for time series decomposition and forecasting and its relevance for portfolio choice - a comparative study of the Indian consumer durable and small cap sector. J. Econ. Libr. 3(2), 303–326 (2016)

    Google Scholar 

  2. Sen, J., Datta Chaudhuri, T.: An investigation of the structural characteristics of the indian IT sector and the capital goods sector - an application of the R programming language in time series decomposition and forecasting. J. Insur. Financ. Manag. 1(4), 68–132 (2016)

    Google Scholar 

  3. Sen, J., Datta Chaudhuri, T.: Understanding the sectors of indian economy for portfolio choice. Int. J. Bus. Forecast. Mark. Intell. 4(2), 178–222 (2018)

    Google Scholar 

  4. Sen, J., Datta Chaudhuri, T.: A robust predictive model for stock price forecasting. In: Proceedings of the 5th International Conference on Business Analytics and Intelligence, Bangalore, India, 11–13 December 2017 (2017)

    Google Scholar 

  5. Sen, J.: Stock price prediction using machine learning and deep learning frameworks. In: Proceedings of the 6th International Conference on Business Analytics and Intelligence, Bangalore, India, 20–22 December 2018 (2018)

    Google Scholar 

  6. Mehtab, S., Sen, J.: A robust predictive model for stock price prediction using deep learning and natural language processing. In: Proceedings of the 7th International Conference on Business Analytics and Intelligence, Bangalore, India, 5–7 December 2019 (2019)

    Google Scholar 

  7. Mehtab, S., Sen, J.: Stock price prediction using convolutional neural network on a multivariate time series. In: Proceedings of the 3rd National Conference on Machine Learning and Artificial Intelligence (NCMLAI), New Delhi, India, 1 February 2020 (2020)

    Google Scholar 

  8. Mehtab, S., Sen, J.: A time series analysis-based stock price prediction using machine learning and deep learning models. Technical Report, No: NSHM_KOL_2020_SCA_DS_1 (2020). https://doi.org/10.13140/RG.2.2.14022.22085/2

  9. Enke, D., Grauer, M., Mehdiyev, N.: Stock market prediction with multiple regression, fuzzy type-2 clustering, and neural networks. Proc. Comput. Sci. 6, 201–206 (2011)

    Article  Google Scholar 

  10. Ma, J., Liu, L.: Multivariate nonlinear analysis and prediction of shanghai stock market. Discrete Dyn. Nat. Soc. 2008, 1–9 (2008). Article ID: 526734

    Google Scholar 

  11. Khan, U., et al.: A robust regression-based stock exchange forecasting and determination of correlation between stock markets. Sustainability 10, 3702 (2018)

    Google Scholar 

  12. Sharma, V., Khemnar, R., Kumari, R., Mohan, B.R.: Time series with sentiment analysis for stock price prediction. In: Proceedings of the IEEE International Conference on Intelligent Communication and Computational Techniques (ICCT), Jaipur, India (2019)

    Google Scholar 

  13. Ivanovski, Z., Ivanovska, N., Narasanov, Z.: The regression analysis of stock returns at MSE. J. Mod. Account. Audit. 12(4), 217–224 (2016)

    Google Scholar 

  14. Adebiyi, A.A., Adewumi, A.O., Ayo, C.K.: Stock price prediction using the ARIMA model. In: Proceedings of the International Conference on Computer Modelling and Simulation, Cambridge, UK, pp. 105–111 (2014)

    Google Scholar 

  15. Xiao, Y., Xiao, J., Liu, J., Wang, S.: A multiscale modeling approach incorporating ARIMA and ANNs for financial market volatility forecasting. J. Syst. Sci. Complex. 27(1), 225–236 (2014). https://doi.org/10.1007/s11424-014-3305-4

    Article  Google Scholar 

  16. Jammalamadaka, S.R., Qiu, J., Ning, N.: Predicting a stock portfolio with multivariate Bayesian structural time series model: do news or emotions matter? Int. J. Artif. Intell. 17(2), 81–104 (2019)

    Google Scholar 

  17. Selvin, S., Vinayakumar, R., Gopalakrishnan, E.A., Menon, V.K., Soman, K.P.: Stock price prediction using LSTM, RNN, and CNN-sliding window model. In: Proceedings of the IEEE International Conference on Advances in Computing, Communications, and Informatics (ICACCI), Udupi, India, pp. 1643–1647 (2017)

    Google Scholar 

  18. Kim, M., Sayama, H.: Predicting stock market movements using network science: an information-theoretic approach. Appl. Netw. Sci. 2, 1–14 (2017). Article No: 35

    Google Scholar 

  19. Wang, Z., Ho, S-B., Lin, Z.: Stock market prediction analysis by incorporating social and news opinion and sentiment. In: Proceedings of the IEEE International Conference on Data Mining Workshops, Singapore (2018)

    Google Scholar 

  20. Porshnev, A., Redkin, I., Shevchenko, A.: Machine learning in prediction of stock market indicators based on historical data and data from Twitter sentiment analysis. In: Proceedings of the IEEE International Conference on Data Mining Workshops, Dallas, TX, USA (2013)

    Google Scholar 

  21. Tang, J., Chen, X.: Stock market prediction based on historic prices and news titles. In: Proceedings of the International Conference on Machine Learning Technologies (ICMLT), Jinan, China, pp. 29–34 (2018)

    Google Scholar 

  22. Obthong, M., Tantisantiwong, N., Jeamwatthanachai, W., Wills, G.: A survey on machine learning for stock price prediction: algorithms and techniques. In: Proceedings of the 2nd International Conference on Finance, Economics, Management and IT Business, FEMIB 2020, Prague, Czech Republic, 5–6 May 2020 (2020)

    Google Scholar 

  23. Zhou, J., Fan, P.: Modulation format/bit rate recognition based on principal component analysis (PCA) and artificial neural networks (ANNs). OSA Continuum 2(3), 923–937 (2019)

    Article  Google Scholar 

  24. Yahoo Finance Website. https://in.finance.yahoo.com

  25. Brownlee, J.: Introduction to Time Series Forecasting with Python (2019)

    Google Scholar 

  26. Geron, A.: Hands-on Machine Learning with Scikit-Learn Keras & Tensorflow. O’Reilly Publications, Sebastopol (2019)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Jaydip Sen .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2021 Springer Nature Singapore Pte Ltd.

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Mehtab, S., Sen, J., Dutta, A. (2021). Stock Price Prediction Using Machine Learning and LSTM-Based Deep Learning Models. In: Thampi, S.M., Piramuthu, S., Li, KC., Berretti, S., Wozniak, M., Singh, D. (eds) Machine Learning and Metaheuristics Algorithms, and Applications. SoMMA 2020. Communications in Computer and Information Science, vol 1366. Springer, Singapore. https://doi.org/10.1007/978-981-16-0419-5_8

Download citation

  • DOI: https://doi.org/10.1007/978-981-16-0419-5_8

  • Published:

  • Publisher Name: Springer, Singapore

  • Print ISBN: 978-981-16-0418-8

  • Online ISBN: 978-981-16-0419-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics