研究生: |
林子哲 Lin, Tz-Je |
---|---|
論文名稱: |
以LSTM、Bi-LSTM及Transformer模型預測台股股價準確度的研究 A Study on the Prediction Accuracy of Taiwan Stock Market by LSTM, Bi-LSTM and Transformer Models |
指導教授: |
周榮華
Chou, Jung-Hua |
學位類別: |
碩士 Master |
系所名稱: |
工學院 - 工程科學系碩士在職專班 Department of Engineering Science (on the job class) |
論文出版年: | 2024 |
畢業學年度: | 112 |
語文別: | 中文 |
論文頁數: | 108 |
中文關鍵詞: | 深度學習 、長短期記憶(LSTM) 、雙向長短期記憶(Bi-LSTM) 、自注意力機制(Transformer) 、股票價格預測 |
外文關鍵詞: | Deep Learning, LSTM, Bi-LSTM, Transformer, Stock Price Prediction |
相關次數: | 點閱:128 下載:0 |
分享至: |
查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報 |
本研究旨在透過深度學習模型,特別是LSTM、Bi-LSTM及Transformer,以集各種技術指標和法人數據,來提升台灣股市價格預測的準確性,並讓模型可以適應股市的高度非線性和時間序列數據的特性。研究使用了自twstock和台灣證券交易所網站收集的數據,包括股票的日收盤價、交易量、最高價和最低價等信息。透過計算特徵與股價的相關係數,挑選出皮爾森相關係數(PCCs)在>0與>0.6的特徵以訓練模型,為避免洩漏,收盤價不為特徵值之一。模型的表現通過均方誤差(MSE)、平均絕對誤差(MAE)、平均絕對百分比誤差(MAPE)及R2等指標進行評估,結果顯示結合深度學習模型與三大法人數據能預測的準確度。在本研究中發現,LSTM表現出色,這可能是由於其能有效捕捉時間序列數據中的長期依賴關係,加上 運算時間最少,在使用皮爾森相關係數超過 0.6的特徵值後, R2值達到0.9615,而經過數據調整後進一步提升至0.9904,本研究提供了一種有效的股價預測方式。
This study aims to predict the trend of Taiwan stock market by employing deep learning models, specifically LSTM, Bi-LSTM and Transformer. By leveraging Pearson correlation coefficients for feature selection, the models adapted to the stock market's nonlinear and time-series characteristics. The LSTM model demonstrates superior performance with an R2 value of 0.96 and improving to 0.99 with data adjustments. Thus, this research presents an effective method for stock price prediction for investment reference.
[1] 杜佩蓉, "花卉銷售預測研究-以 A 花店為例," 碩士, 工程科學系碩士在職專班, 國立成功大學, 台南市, 2023. [Online]. Available:https://hdl.handle.net/11296/8ppj3y
[2] 夏鶴芸, "應用深度學習與自然語言處理新技術預測股票走勢 – 以台積電為例,"碩士, 資訊管理研究所, 國立臺北大學, 新北市, 2020. [Online]. Available:https://hdl.handle.net/11296/u2x8kh
[3] 莊惠如, "運用深度學習LSTM預測台積電股價," 碩士, 人工智慧與資料科學碩士在職學位學程, 國立中興大學, 台中市, 2024. [Online]. Available:https://hdl.handle.net/11296/p99dxt
[4] A. Sethia and P. Raut, "Application of LSTM, GRU and ICA for Stock Price Prediction," in Information and Communication Technology for Intelligent Systems: Springer Singapore, 2019, pp. 479-487.
[5] K. A. Althelaya, E. S. M. El-Alfy, and S. Mohammed, "Evaluation of bidirectional LSTM for short-and long-term stock market prediction," in 2018 9th International Conference on Information and Communication Systems (ICICS), 3-5 April 2018, pp. 151-156, doi: 10.1109/IACS.2018.8355458.
[6] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, Aidan N. Gomez, L. Kaiser, and I. Polosukhin, "Attention is all you need," Advances in neural information processing systems, vol. 30, pp. 5998-6008, 2017.
[7] W. Lu, J. Li, Y. Li, A. Sun, and J. Wang, "A CNN-LSTM-Based Model to Forecast Stock Prices," Complexity, vol. 2020, pp. 1-10, 2020-11-23 2020, doi:10.1155/2020/6622927.
[8] 陳允傑, TensorFlow 與Keras:Python 深度學習應用實務. 旗標科技, 2019.
[9] R. Jozefowicz, W. Zaremba, and I. Sutskever, "An empirical exploration of recurrent network architectures," in International conference on machine learning, 2015: PMLR, pp. 2342-2350.
[10] H.-y. Lee. "Training Recurrent Neural Network." http://speech.ee.ntu.edu.tw/~tlkagk/courses_MLSD15_2.html (accessed 2023/04/22.)
[11] 謝忠佑, "以機器終生學習法訓練網路入侵偵測系統," 碩士, 工程科學系碩士在職專班, 國立成功大學, 台南市, 2021.
[12] S. Hochreiter and J. Schmidhuber, "Long short-term memory," Neuralcomputation, vol. 9, no. 8, pp. 1735-1780, 1997.
[13] B. Bakker, F. Linaker, and J. Schmidhuber, "Reinforcement learning in partially observable mobile robot domains using unsupervised event extraction," in IEEE/RSJ International Conference on Intelligent Robots and Systems, 2002, vol. 1: IEEE, pp. 938-943.
[14] F. A. Gers, D. Eck, and J. Schmidhuber, "Applying LSTM to time series predictable through time-window approaches," in Artificial Neural Networks—ICANN 2001: International Conference Vienna, Austria, August 21–25, 2001 Proceedings 11, 2001: Springer, pp. 669-676.
[15] M. Wöllmer, E. Marchi, S. Squartini, and B. Schuller, "Multi-stream LSTM-HMM decoding and histogram equalization for noise robust keyword spotting," Cognitive neurodynamics, vol. 5, pp. 253-264, 2011.
[16] R. C. Staudemeyer, "Applying long short-term memory recurrent neural networks to intrusion detection," South African Computer Journal, vol. 56, no. 1, pp. 136-154, 2015.
[17] Q. Yu, K. Wang, J. O. Strandhagen, and Y. Wang, "Application of long short-term memory neural network to sales forecasting in retail—a case study," in Advanced Manufacturing and Automation VII 7, 2018: Springer, pp. 11-17.
[18] A. Zheng and A. Casari, Feature engineering for machine learning: principles and techniques for data scientists. " O'Reilly Media, Inc.", 2018.
[19] C. Olah, "Understanding lstm networks," 2015. [Online]. Available:http://colah.github.io/posts/2015-08-Understanding-LSTMs/.
[20] paperswithcode. "Bidirectional LSTM." https://paperswithcode.com/method/bilstm (accessed 06-25, 2024)
[21] C. Wang, Y. Chen, S. Zhang, and Q. Zhang, "Stock market index prediction using deep Transformer model," Expert Systems with Applications, vol. 208, p. 118128, 2022.
[22] Google. "Neural machine translation with a Transformer and Keras " https://www.tensorflow.org/text/tutorials/transformer (accessed 06-25, 2024).
[23] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova, "Bert: Pre-training of deep bidirectional transformers for language understanding," arXiv preprint arXiv:1810.04805, 2018.
[24] G. Dong and H. Liu, Feature engineering for machine learning and data analytics. CRC press, 2018.
[25] Z.-L. Sun, T.-M. Choi, K.-F. Au, and Y. Yu, "Sales forecasting using extreme learning machine with applications in fashion retailing," Decision Support Systems, vol. 46, no. 1, pp. 411-419, 2008.
[26] G. Tsoumakas, "A survey of machine learning techniques for food sales prediction," Artificial Intelligence Review, vol. 52, no. 1, pp. 441-447, 2019.
[27] S. Athey and G. W. Imbens, "Machine learning methods that economists should know about," Annual Review of Economics, vol. 11, pp. 685-725, 2019.
[28] X. Li, J. Du, Y. Wang, and Y. Cao, "Automatic sales forecasting system based on LSTM network," in 2020 International Conference on Computer Science and Management Technology (ICCSMT), 2020: IEEE, pp. 393-396.
[29] T.-K. Hung, "移動平均線, 趨向指標及籌碼集中度應用於台股之實證研究─ 以台積電, 聯電為例," National Central University, 2022.
[30] tradingview. "雙指數移動均線(EMA)."https://tw.tradingview.com/support/solutions/43000589132/ (accessed 6/25, 2024).
[31] M. M. 市場先生. "MACD教學-MACD是什麼?如何判斷MACD指標的意思?." https://rich01.com/what-is-macd-indicator/ (accessed 6/25, 2024).
[32] J. Bollinger, Bollinger on Bollinger bands. McGraw-Hill New York, 2002.
[33] 許江河 and 李孟儒, "交易部位資金管理之研究績效-22 種近月份海外期貨為例," 國立虎尾科技大學學報, vol. 34, no. 4, pp. 1-11, 2019.
[34] S. Gold, "The Viability of Six Popular Technical Analysis Trading Rules in Determining Effective Buy and Sell Signals: MACD, AROON, RSI, SO, OBV, and ADL," Journal of Applied Financial Research, vol. 2, 2015.
[35] L. Markus and A. Weerasinghe, "Stochastic oscillators," Journal of differential equations, vol. 71, no. 2, pp. 288-314, 1988.
[36] I. Cohen, Y. Huang, J. Chen, J. Benesty, "Pearson correlation coefficient," Springer Noise reduction in speech processing, pp. 1-4, 2009.
[37] C. M. Bishop, "Pattern recognition and machine learning," Springer google schola, vol. 2, pp. 1122-1128, 2006.
[38] T. Zhang and B. Yu, "Boosting with early stopping: Convergence and consistency," The Annals of Statistics, Vol. 33, No. 4, 1538–1579, 2005.
[39] Tom O'Malley, Elie Bursztein,James Long, François Chollet, Haifeng Jin,Luca Invernizzi and others. "KerasTuner." https://github.com/keras-team/keras-tuner(accessed 6/25, 2024).
[40] www.geeksforgeeks.org. "What is Adam Optimizer?" https://www.geeksforgeeks.org/adam-optimizer/ (accessed 6/25, 2024).
[41] wikipedia. "均方誤差 MSE." https://zh.wikipedia.org/zhtw/%E5%9D%87%E6%96%B9%E8%AF%AF%E5%B7%AE (accessed 6/25,2024).
[42] wikipedia. "平均絕對誤差 MAE."https://zh.wikipedia.org/wiki/%E5%B9%B3%E5%9D%87%E7%BB%9D%E5%AF%B9%E8%AF%AF%E5%B7%AE (accessed 6/25, 2024).
[43] Oracle. "MAPE (平均絕對百分比誤差)."https://docs.oracle.com/cloud/help/zh_TW/pbcs_common/PFUSU/insights_metrics_MAPE.htm#PFUSU-GUID-C33B0F01-83E9-468B-B96C-413A12882334(accessed 2024.
[44] wikipedia. "決定係數 R^2." https://zh.wikipedia.org/zhtw/%E5%86%B3%E5%AE%9A%E7%B3%BB%E6%95%B0 (accessed 6/25,2024).
[45] wikipedia. "混淆矩陣 confusion matrix." https://zh.wikipedia.org/zhtw/%E6%B7%B7%E6%B7%86%E7%9F%A9%E9%98%B5 (accessed 06/25,2024).
[46] D. Chicco, M. J. Warrens, and G. Jurman, "The coefficient of determination Rsquared is more informative than SMAPE, MAE, MAPE, MSE and RMSE in regression analysis evaluation," (in English), PeerJ Computer Science, 2021 Jul 05 2021, doi: https://doi.org/10.7717/peerj-cs.623.
[47] D. Chicco, M. J. Warrens, and G. Jurman, "The coefficient of determination Rsquared is more informative than SMAPE, MAE, MAPE, MSE and RMSE in regression analysis evaluation," PeerJ Computer Science, vol. 7, p. e623, 2021.
[48] I. Lin. "R 數值預估評估方法." https://reurl.cc/o0Q1Rv (accessed 04/08, 2023).