
Stock Price Prediction Based on CNN-BiLSTM Utilizing Sentiment Analysis and a Two-layer Attention Mechanism
- 1 University of Southampton
* Author to whom correspondence should be addressed.
Abstract
The recent robust growth of the economy has instigated a heightened interest among financial experts in the domain of stock forecasting. Stock price forecasting frequently involves a non-linear time series projection due to the volatility nature of the stock market. This research proposes and develops an effective method with sentiment analysis neural network model for forecasting the closing price of the following day based on the time-series properties of stock price data. Several factors affect stock prices at the same time. Simple models can only predict with difficulty. As a result, sentiment analysis will be included in this study to increase the model's precision. The model architecture encompasses the utilization of a Convolutional Neural Network (CNN) for extracting salient features from input data, Bidirectional Long Short-Term Memory (BiLSTM) for acquiring knowledge and forecasting the extracted features, and an Attention Mechanism (AM) for capturing alterations in feature states within the time series data during the prediction process. The NASDAQ Composite Index's closing price the next day for 1281 trading days was predicted using this method in conjunction with three other methods to show the method's efficacy. The experimental results demonstrate that among the four techniques with sentiment analysis, CNN-BiLSTM-AM with sentiment analysis achieve the highest prediction accuracy and performance, and the errors of this model are the smallest. The CNN-BiLSTM-AM approach with sentiment analysis outperforms the other methods in terms of suitability for stock price prediction and is better able to guide investors towards more profitable stock investing choices.
Keywords
CNN-BiLSTM, attention mechanism, stock price prediction, sentiment analysis
[1]. Peters, E. E. (1996). Chaos and order in the capital markets: A new view of cycles, prices, and market volatility. Oxford: Wiley
[2]. Ersan, D., Nishioka, C. & Scherp. (2020) A. Comparison of machine learning methods for financial time series forecasting at the examples of over 10 years of daily and hourly data of DAX 30 and S&P 500. J Comput Soc Sc 3, 103–133.
[3]. Malkiel, B. G. (2003). The efficient market hypothesis and its critics. Journal of Economic Perspectives, 17(1), 59–82
[4]. Lo, A. W. (2004). The adaptive markets hypothesis: Market efficiency from an evolutionary perspective. Journal of Portfolio Management, Forthcoming
[5]. Urquhart, A., & Hudson, R. (2013). Efficient or adaptive markets? Evidence from major stock markets using very long run historic data. International Review of Financial Analysis, 28, 130-142.
[6]. Siami-Namini, S., Tavakoli, N., & Namin, A. S. (2018). A comparison of ARIMA and LSTM in forecasting time series. In 2018 17th IEEE international conference on machine learning and applications (ICMLA) (pp. 1394-1401). IEEE
[7]. Teixeira, L. A., & De Oliveira, A. L. I. (2010). A method for automatic stock trading combining technical analysis and nearest neighbor classification. Expert systems with applications, 37(10), 6885-6890.
[8]. Fletcher, T., Shawe-Taylor, J. (2013). Multiple kernel learning with fisher kernels for high frequency currency prediction. Computational Economics, 42: 217-240.
[9]. Qiu, M., Song, Y., & Akagi, F. (2016). Application of artificial neural network for the prediction of stock market returns: The case of the Japanese stock market. Chaos, Solitons & Fractals, 85, 1-7.
[10]. Kwon, Y. K., & Moon, B. R. (2007). A hybrid neurogenetic approach for stock forecasting. IEEE transactions on neural networks, 18(3), 851-864.
[11]. Ding, X., Zhang, Y., Liu, T., & Duan, J. (2015). Deep learning for event-driven stock prediction. In Twenty-fourth international joint conference on artificial intelligence.
[12]. Chen, W., Zhang, Y., Yeo, C. K., Lau, C. T., & Lee, B. S. (2017). Stock market prediction using neural network through news on online social networks. In 2017 international smart cities conference (ISC2) (pp. 1-6). IEEE.
[13]. Lu, W., Li, J., Wang, J. et al. (2021). A CNN-BiLSTM-AM method for stock price prediction. Neural Comput & Applic 33, 4741–4753.
[14]. Chatrath, A., Miao, H., Ramchander, S., & Villupuram, S. (2014). Currency jumps, cojumps and the role of macro news. Journal of International Money and Finance, 40, 42-62.
[15]. Wikipedia. Reddit Website Traffic, Ranking, Analytics [February 2023]. Semrush. Retrieved May 9, 2022. https://en.wikipedia.org/wiki/Reddit#References
[16]. Fukushima, K. (1980). Neocognitron: A self-organizing neural network model for a mechanism of pattern recognition unaffected by shift in position. Biological cybernetics, 36(4), 193-202.
[17]. Lecun, Y., Botou, L., Bengio, Y., Haffner, P. (1998) Gradient-based learning applied to document recognition. Proc IEEE 86(11):2278–2324.
[18]. Chen, J. F., et al. (2016). Financial time-series data analysis using deep convolutional neural networks, 7th International Conference on Cloud Computing and Big Data (CCBD), pp. 87-92.
[19]. Ba, J. L., et al. (2015) Predicting deep zero-shot convolutional neural networks using textual descriptions, IEEE International Conference on Computer Vision, pp. 4247-55.
[20]. Hu, G., et al. (2017). Deep stock representation learning: from candlestick charts to investment decisions.
[21]. Hao, Y., Gao, Q. (2020). Predicting the trend of stock market index using the hybrid neural network based on multiple time scale feature learning. Appl Sci 10(11):3961–3974
[22]. Kamalov, F. (2020). Forecasting significant stock price changes using neural networks. Neural Comput Appl.
[23]. Hochreiter, S., Schmidhuber, J. (1997). Long Short-Term Memory. MIT Press 9(8):1735-1780
[24]. Ta, V., Liu, C., Tadesse, D. (2020). Portfolio optimization-based stock prediction using long-short term memory network in quantitative trading. Appl Sci 10(2):437–456
[25]. Wikipedia, (2023) Long short-term_memory, https://en.wikipedia.org/wiki/Long_short-term_memory
[26]. Liu, W., Zhang, Y., Liu, Y. (2022). Attention-based BiLSTM model for stock price prediction, Proceedings of the 2022 5th International Conference on Artificial Intelligence and Pattern Recognition, 257-263.
Cite this article
Zheng,X. (2023). Stock Price Prediction Based on CNN-BiLSTM Utilizing Sentiment Analysis and a Two-layer Attention Mechanism. Advances in Economics, Management and Political Sciences,47,40-49.
Data availability
The datasets used and/or analyzed during the current study will be available from the authors upon reasonable request.
Disclaimer/Publisher's Note
The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of EWA Publishing and/or the editor(s). EWA Publishing and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
About volume
Volume title: Proceedings of the 2nd International Conference on Financial Technology and Business Analysis
© 2024 by the author(s). Licensee EWA Publishing, Oxford, UK. This article is an open access article distributed under the terms and
conditions of the Creative Commons Attribution (CC BY) license. Authors who
publish this series agree to the following terms:
1. Authors retain copyright and grant the series right of first publication with the work simultaneously licensed under a Creative Commons
Attribution License that allows others to share the work with an acknowledgment of the work's authorship and initial publication in this
series.
2. Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the series's published
version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgment of its initial
publication in this series.
3. Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and
during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See
Open access policy for details).