تحقیقات مالی

تحقیقات مالی

ارائه مدلی برای پیش‌بینی قیمت سهام مبتنی بر شبکۀ عصبی پیچشی و شبکۀ عصبی حافظۀ کوتاه‌مدت ماندگار

نوع مقاله : مقاله علمی پژوهشی

نویسندگان
1 کارشناس ارشد، گروه مدیریت مالی، دانشکدۀ مدیریت و حسابداری، دانشکدگان فارابی، دانشگاه تهران، قم، ایران.
2 استادیار، گروه مدیریت مالی، دانشکدۀ مدیریت و حسابداری، دانشکدگان فارابی، دانشگاه تهران، قم، ایران.
10.22059/frj.2025.369854.1007546
چکیده
هدف: در دهه‌های اخیر، پیش‌بینی قیمت سهام به‌عنوان یکی از چالش‌های مهم در حوزه مالی مورد توجه قرار گرفته است. از آنجا که قیمت سهام تحت‌تأثیر عوامل گوناگونی از جمله شرایط اقتصادی، اخبار رویدادها و تغییرات در بازار قرار می‌گیرد، توسعۀ مدل‌های دقیق و پیشرفته برای پیش‌بینی آن از اهمیت ویژه‌ای برخوردار است. در این پژوهش برای پیش‌بینی قیمت سهام از مدل‌های یادگیری عمیق استفاده شده است.
روش: این پژوهش از منظر هدف، کاربردی و از نظر نوع داده‌ها، کمّی است. تمرکز اصلی در این پژوهش، روی مدل‌های یادگیری است. داده‌های پژوهش در بازۀ زمانی سال‌های ۱۳۸۰ تا ۱۴۰۰ (در مجموع ۲۱ سال) جمع‌آوری شده است. پالایش اولیۀ داده‌ها با استفاده از نرم‌افزار اکسل صورت پذیرفته است. در ادامه، برای پیش‌پردازش داده‌ها، از توزیع‌کنندۀ آناکوندا و مفسر ژوپیتر نوت بوک استفاده شده است. برای تحلیل و پیش‌پردازش داده‌ها، از کتابخانه‌های Pandas، Numpy وscikit-learn و برای نمایش داده‌ها، از کتابخانۀ Matplotlib و برای پیش‌بینی قیمت، از کتابخانه‌های keras و Tensorflow استفاده شده است. در این پژوهش از دو مدل به‌صورت مستقل و یک مدل ترکیبی برای پیش‌بینی قیمت بهره برده شده است. مدل‌های مستقل از سه لایه تشکیل شده‌اند و عبارت‌اند از: مدل شبکۀ عصبی پیچشی و مدل شبکۀ عصبی حافظۀ کوتاه‌مدت ماندگار. مدل ترکیبی نیز از چهار لایه تشکیل شده؛ یعنی برای استخراج ویژگی‌ها، از شبکۀ عصبی پیچشی و برای پیش‌بینی داده‌ها، از شبکۀ عصبی حافظۀ کوتاه‌مدت ماندگار استفاده شده است. مراحل انجام پژوهش به این صورت بوده است که ابتدا داده‌ها وارد نرم‌افزار شده، سپس در مقیاس داده‌ها تغییر ایجاد شد. در ادامه، داده‌ها به دو دسته آموزش و آزمون تقسیم شدند؛ به‌گونه‌ای که ۸۰ درصد داده‌ها برای آموزش مدل و مابقی برای آزمون استفاده شدند. در نهایت، داده‌ها از حالت سری زمانی به‌صورت نظارت شده تبدیل و وارد مدل شدند. برای ارزیابی مدل‌ها، از سه معیار ارزیابی که شامل ضریب تعیین، خطای میانگین مطلق و ریشه میانگین مربعات خطا استفاده شد.
یافته‌ها: نتایج به‌دست‌آمده از معیارهای ارزیابی، نشان می‌دهد که مدل ترکیبی و مدل شبکۀ عصبی پیچشی نتایج قابل قبولی دارند؛ اما نتایج حاصل از مدل شبکۀ عصبی حافظۀ کوتاه‌مدت ماندگار، مطلوب نیست. این نتایج نشان می‌دهد که علاوه‌بر انتخاب صحیح متغیرهای مستقل و همچنین، تعریف و پیکربندی درست مدل که برای مدل‌های یادگیری عمیق بسیار لازم است، استخراج ویژگی‌ها، تأثیر بسزایی در پیش‌بینی مدل دارد؛ زیرا نتایج نشان می‌دهد که مدل شبکۀ عصبی پیچشی، نسبت به مدل شبکۀ عصبی حافظۀ کوتاه‌مدت ماندگار عملکرد بهتری دارد، در حالی که مدل‌های بازگشتی مانند شبکۀ عصبی حافظۀ کوتاه‌مدت ماندگار، اغلب نتایج مطلوبی در پیش‌بینی سری‌های زمانی از خود نشان داده‌اند. در نهایت، نتایج نشان می‌دهد که ترکیب این دو مدل عملکرد بهتری نسبت هر یک از مدل‌ها دارد.
نتیجه‌گیری: وجود عواملی مانند دامنۀ نوسان در دقت مدل‌ها اثرگذاری زیادی دارند و اریب مدل را افزایش می‌دهند؛ اما در این پژوهش که از متغیرهای فنی استفاده شده است، نتایج پژوهش نشان می‌دهد که برای رسیدن به نتایج مطلوب، علاوه‌بر انتخاب نوع شبکۀ عصبی، تعداد لایه‌های هر مدل نیز در نتایج مؤثر است؛ زیرا مدل‌های بسیار ساده یا بسیار پیچیده، باعث ایجاد مشکلاتی اعم از کم برازش یا بیش برازش خواهد شد. همچنین انتخاب ویژگی‌ها (متغیرهای مستقل) نیز اثر شایان توجهی در نتایج خواهد داشت.
کلیدواژه‌ها
موضوعات

عنوان مقاله English

Developing a Stock Price Prediction Model Using a Convolutional Neural Network and Long Short-Term Memory

نویسندگان English

Mostafa Shaygani 1
Asgar Noorbakhsh 2
1 MSc., Department of Financial Management, Faculty of Management and Accounting, Farabi Campus, University of Tehran, Qom, Iran.
2 Assistant Prof., Department of Financial Management, Faculty of Management and Accounting, Farabi Campus, University of Tehran, Qom, Iran.
چکیده English

Objective
Predicting stock prices remains a significant challenge in the field of finance due to the complex and dynamic factors that influence market behavior, including economic conditions, financial news, and market fluctuations. Consequently, the development of accurate and robust prediction models has become increasingly important for supporting investment decisions and risk management. In this study, deep learning techniques are employed to develop a model for stock price prediction.

Methods
In this research, which is pragmatically oriented in terms of research objectives and quantitative in terms of data type, the focus is on learning models. The data used covers 21 years from 2001 to 2022. Initial data preprocessing was carried out using Excel software. Subsequently, for data preprocessing, the Anaconda distribution and Jupyter Notebook interpreter were employed. Pandas, NumPy, and scikit-learn libraries were used for data analysis and preprocessing, and the matplotlib library was utilized for data visualization. For price prediction, the Keras and TensorFlow libraries were employed. This study employed two approaches for stock price prediction: single models and a hybrid model. The single-model approach utilized either a Convolutional Neural Network (CNN) or a Long Short-Term Memory (LSTM) network, with each model comprising three layers. The hybrid model consisted of four layers, combining a CNN for feature extraction with an LSTM for sequential prediction, thereby leveraging the strengths of both architectures to improve prediction performance. The research process involves importing data, scaling the data, dividing it into training and testing sets (80% for training and the rest for testing), and transforming the data from time series to supervised learning. Finally, the data are fed into the models. Three evaluation metrics, R-Square, MAE, and RMSE, are used to assess the models.

Results
The results obtained from the evaluation criteria indicate that the hybrid model and the convolutional neural network (CNN) model yield acceptable results, while the outcomes from the short-term memory neural network model are less desirable. These findings underscore the importance of not only selecting the correct independent variables and defining and configuring the model correctly, which are essential prerequisites for deep learning models, but also highlight the significant impact of feature extraction on model prediction. The results demonstrate that the CNN model outperforms the short-term memory neural network model, while recurrent models such as the short-term memory neural network have often shown favorable outcomes in predicting time series. Ultimately, the results suggest that combining these two models leads to better performance compared to each individual model.

Conclusion
The presence of factors such as the range of fluctuations in model accuracy has a significant impact and increases the uncertainty of the model. However, in this research, which exclusively utilizes technical variables, the results indicate that, to achieve desirable outcomes, the choice of neural network architecture is crucial. Additionally, the number of layers in each model also proves to be influential in the results, as models that are overly simplistic or excessively complex can lead to issues such as underfitting or overfitting. Furthermore, the selection of features (independent variables) will also have a considerable impact on the results.

کلیدواژه‌ها English

Stock price prediction
Convolutional Neural Network
Long Short-Term Memory Neural Network
Artificial Neural Network
اصولیان، محمد؛ نیک‌مرام، علی و کریمی، مهدی (1404). پیش‌بینی روند شاخص کل با استفاده از شبکه‌های عصبی هیبریدی با تمرکز بر استخراج ویژگی مقیاس زمانی چندگانه در بورس اوراق بهادار تهران. تحقیقات مالی، 27 (1)، 85- 113.
حیدری، مهدی و امیری، حمیدرضا (1401). بررسی قدرت مدل‌های مبتنی بر هوش مصنوعی در پیش‌بینی روند قیمت سهام بورس اوراق بهادار تهران. تحقیقات مالی، 24 (4)، 602- 623.
فقیهی نژاد، محمد تقی؛ مینایی، بهروز (1397). پیش‌بینی رفتار بازار سهام بر اساس شبکه‌‌های عصبی مصنوعی با رویکرد یادگیری جمعی هوشمند. فصلنامه مدیریت صنعتی، 10(1)، 315- 334.
References
Borovykh, A., Bohte, S. & Oosterlee, C. W. (2017). Conditional time series forecasting with convolutional neural networks. arXiv preprint arXiv:1703.04691.
Cao, J., Li, Z., & Li, J. (2019). Financial time series forecasting model based on CEEMDAN and LSTM. Physica A: Statistical mechanics and its applications, 519, 127-139.
Chong, E., Han, Ch. & Park F. (2017). Deep learning networks for stock market analysis and prediction: Methodology, data representations, and case studies. Expert Systems with Applications, (83), 187-205.
Faghihi Nezhad, M. T. & Minaei, B. (2018). Prediction of Stock Market Behavior Based on Artificial Neural Networks through Intelligent Ensemble Learning Approach. Industrial Management Journal, 10(2), 315-334. doi: 10.22059/imj.2018.255079.1007412
(in Persian)
Heidari, M. & Amiri, H. (2022). Inspecting the Predictive Power of Artificial Intelligence Models in Predicting the Stock Price Trend in Tehran Stock Exchange. Financial Research Journal, 24(4), 602-623. https://doi.org/10.22059/FRJ.2022.320064.1007149  (in Persian)
Hiransha, M. E. A. G., Gopalakrishnan, E. A. & Soman, K. P. (2018). NSE stock market prediction using deep-learning models. Procedia computer science, 132, 1351-1362.
Hochreiter, S. & Schmidhuber, J. (1997). Long short-term memory. Neural Computation, 9(8), 1735–1780.
Jing, N., Wu, Z. & Wang, H. (2021). A hybrid model integrating deep learning with investor sentiment analysis for stock price prediction. Expert Systems with Applications, 178, 115019.
Khare, K., Darekar, O., Gupta, P. & Attar, V. Z. (2017, May). Short term stock price prediction using deep learning. In 2017 2nd IEEE international conference on recent trends in electronics, information & communication technology (RTEICT) (pp. 482-486). IEEE.
Lee, C. Y. & Soo, V. W. (2017, December). Predict stock price with financial news based on recurrent convolutional neural networks. In 2017 conference on technologies and applications of artificial intelligence (TAAI) (pp. 160-165). IEEE.
Lee, M. C. (2009). Using support vector machine with a hybrid feature selection method to the stock trend prediction. Expert Systems with Applications, 36 (8), 10896-10904.
Mehtab, S., Sen, J. & Dutta, A. (2020, October). Stock price prediction using machine learning and LSTM-based deep learning models. In Symposium on machine learning and metaheuristics algorithms, and applications (pp. 88-106). Singapore: Springer Singapore.
Noorbakhsh, A. & Shaygani, M. (2024). Deep Learning Approach for Stock Price Prediction: Comparing Single and Hybrid Models. Advances in Industrial Engineering, 58(1), 237-249.
Osoolian, M., Nikmaram, A. & Karimi, M. (2025). Predicting Index Trend Using Hybrid Neural Networks with a Focus on Multi-Scale Temporal Feature Extraction in the Tehran Stock Exchange. Financial Research Journal, 27(1), 85-113. https://doi.org/10.22059/FRJ.2024.377816.1007611  (in Persian)
Oussar, Y. & Dreyfus, G. (2000). Initialization by selection for wavelet network training. Neurocomputing, 34 (1), 131-143.
Sousa, J., Montevechi, J. & Miranda, R. (2019). Economic lot-size using machine learning, parallelism, metaheuristic, and simulation. Journal of Logistics, Informatics, and Service Science, 18 (2), 205-216.
Vanaga, R. & Sloka, B. (2020). Financial and capital market commission financing: Aspects and challenges. Journal of Logistics, 7 (1), 17-30.
Yamak, P. T., Yujian, L. & Gadosey, P. K. (2019, December). A comparison between arima, lstm, and gru for time series forecasting. In Proceedings of the 2019 2nd international conference on algorithms, computing and artificial intelligence (pp. 49-55).
Zhang, L. & Kim, H. (2020). The influence of financial service characteristics on use intention through customer satisfaction with mobile fintech. Journal of System and Management Sciences, 10 (2), 82-94.
Zhang, X., Zhang, Y., Wang, S., Yao, Y., Fang, B. & Yu, P. S. (2019). Improving stock market prediction via heterogeneous information fusion. Knowledge-Based Systems, 166, 1–11.
Zhong, X. & Enke, D. (2019). Predicting the daily return direction of the stock market using hybrid machine learning algorithms. Financial Innovation, 5(1), 1–20.