§ 瀏覽學位論文書目資料
系統識別號 U0002-1807202122442600
DOI 10.6846/TKU.2021.00436
論文名稱(中文) 使用轉移學習建置基於財金新聞情緒的股票趨勢預測模型
論文名稱(英文) Using Transfer Learning for Constructing Stock Trend Prediction Model based on Financial News Sentiment
第三語言論文名稱
校院名稱 淡江大學
系所名稱(中文) 資訊工程學系碩士在職專班
系所名稱(英文) Department of Computer Science and Information Engineering
外國學位學校名稱
外國學位學院名稱
外國學位研究所名稱
學年度 109
學期 2
出版年 110
研究生(中文) 吳昶養
研究生(英文) Chnag-Yang Wu
學號 708410062
學位類別 碩士
語言別 繁體中文
第二語言別
口試日期 2021-06-25
論文頁數 55頁
口試委員 指導教授 - 黃心嘉(sjhwang@mail.tku.edu.tw)
共同指導教授 - 陳俊豪(chchen6814@gmail.com)
委員 - 黃心嘉(sjhwang@mail.tku.edu.tw)
委員 - 呂學展(luhc@mail.ncku.edu.tw)
委員 - 陳朝鈞(chaochun@mail.ncku.edu.tw)
關鍵字(中) 股票預測
轉移學習
漲跌趨勢
買賣建議
機器學習
關鍵字(英) the trend prediction of stocks
transfer learning
buying and selling advice
machine learning
第三語言關鍵字
學科別分類
中文摘要
股票的趨勢預測一直一個令研究人員感興趣的研究課題。因股票相關的財金新聞已被證實是跟股價的漲跌趨勢具有一定的關係,故已有許多方法被提出建置預測趨勢模型。然而,在模型建置過程,訓練資料是否充足對最後結果將有一定的影響,故針對財金新聞量較少的股票進行趨勢漲跌預測時,準確度往往不如人意。為解決此問題,本論文利用轉移學習提出一個基於財金新聞情緒的股票趨勢預測模型。在訓練階段,方法使用三種轉移學習策略找出來源股票用來增加目標股票的訓練資料,包含:同產業新聞數量最多、股價相關性最高或市值最高的公司。接著,在資料前處理部份,使用來源與目標股票的新聞的關鍵字與新聞情緒分數當模型的特徵屬性並以目標股票的股價找出的上漲趨勢模式為標籤,合併特徵值與標籤為趨勢資料集。此資料集則進一步利用深度學習模型建立股票趨勢預測模型。在交易階段,運用建立之趨勢預測模型,投資者將可根據輸出之買進訊號進行股票交易。最後,實驗部份透過從台灣股市所蒐集的資料集驗證方法的有效性。
英文摘要
The trend prediction of stocks has always been an interesting research topic to researchers. Because stock-related financial news has been confirmed to have a certain influence on the stock price fluctuations, many approaches have been proposed to build models for trend prediction. However, in the process of model building, whether the training data is sufficient will have impact on the final result. Therefore, when using the model trained from less financial news to predict stock trends, the accuracy is often unsatisfactory. To solve this problem, this thesis utilizes the transfer learning to construct a stock trend prediction model based on financial news sentiment. In the training phase, the proposed approach uses three transfer learning strategies to find the source stocks to increase the training instances of the target stocks, including companies in the same industry with the largest number of news, the highest stock price correlation, or the company with the highest market capitalization. Then, in the data preprocessing part, using the keywords and news sentiment scores extracted from the source and target stocks as the classification attributes, and the uptrend pattern derived from the stock price of the target stock as the labels, they are merged to form the trend dataset. The dataset is further used to construct the stock trend prediction model using different deep learning models. In the trading phase, utilizing the constructed trend prediction model, investors can trade according to the trading signals generated from the model. Finally, the experiments were made on the dataset collected from the Taiwan stock market to verify the effectiveness of the proposed approach.
第三語言摘要
論文目次
第一章	緒論	1
1.1	研究動機	1
1.2	研究目的	3
1.3	讀者指南	3
第二章	文獻探討與背景知識	4
2.1	情感分析	4
2.2	轉移學習技術	5
2.3	深度學習模型	6
2.4 Word2Vec 模型	7
2.5 TextRank 演算法	7
第三章	使用轉移學習建置基於財金新聞情緒的股票趨勢預測模型	9
3.1系統架構圖	9
3.2轉移學習	10
3.3資料預處理	11
3.3.1上漲趨勢模式標籤	13
3.3.2新聞提取特徵字	15
3.3.3新聞提取關鍵句子	17
3.3.4新聞情緒分析	18
3.4	訓練模型	21
3.4.1訓練資料準備	25
3.4.2訓練模型	25
3.4.3測試模型	26
3.5線上交易	27
3.5	虛擬碼	28
3.6	流程範例	30
第四章	實驗分析與結果	37
4.1實驗資料蒐集	37
4.1.1網路新聞資料蒐集	37
4.1.2股價資料蒐集	38
4.1.3正負面詞庫蒐集	38
4.1.4關鍵詞彙字典蒐集	38
4.1.5 Word to Vector 模型初始化資料蒐集	38
4.2	實驗環境	39
4.3	實驗資料統計	39
4.4	所提方法與無轉移學習之模型比較	40
4.4.1目標股票 : 茂矽無轉移學習準確率	40
4.4.2轉移策略 : 同產業中新聞量最多	41
4.4.3轉移策略 : 同產業中相關性最高	42
4.4.4轉移策略 : 同產業中市值最高	44
4.5	驗證模型準確度最好策略	46
4.6	分類模型準確率比較	47
4.7	使用上漲機率c %尋找最佳化累積報酬	48
第五章 結論與改進	50
參考文獻	52
 
圖目錄
圖 1使用轉移學習建置股票趨勢預測流程圖	9
圖 2使用轉移學習流程圖	10
圖 3資料預處理流程圖	11
圖 4關鍵詞彙轉換成特徵字典流程圖	15
圖 5新聞提取關鍵句子流程圖	17
圖 6新聞情緒分析流程圖	19
圖 7使用SNOWNLP進行情緒分析流程圖	20
圖 8建立模型流程圖	21
圖 9線上交易流程圖	27
圖 10讀取的新聞	30
圖 11 使用TextRank 演算法找出的關鍵字	30
圖 12使用文章常用標點符號對文章進行斷句	31
圖 13將每個句字使用Jieba斷詞得到詞的集合	31
圖 14 新聞中前10名相似分數的句子	32
圖 15關鍵詞彙轉換特徵值清單	34
圖 16模型架構	34
圖 17模型訓練與驗證之精確度	35
圖 18模型訓練與驗證之損失分數	35
 
表目錄
表 1股價處理資料的儲存格式	14
表 2股價處理的資料樣式	14
表 3股價波動前 a 天時間區間漲跌量 b % 和漲跌註記資料的儲存格式	14
表 4股價波動前 a 天時間區間漲跌量 b % 和漲跌註記資料的資料樣式	15
表 5新聞關鍵字的儲存格式	15
表 6新聞關鍵字的資料樣式(僅列出關鍵字欄位)	16
表 7財金關鍵詞彙字典的儲存格式	16
表 8財金關鍵詞彙字典的資料格式	16
表 9處理過新聞的關鍵句儲存格式	18
表 10處理過新聞的關鍵句資料樣式(僅列出部份欄位)	18
表 11新聞情緒分數	21
表 12一般神經網路各層參數設定及說明	22
表 13 RNN神經網路各層參數設定及說明	22
表 14 LSTM神經網路各層參數設定及說明	23
表 15 雙向LSTM神經網路各層參數設定及說明	23
表 16 GRU神經網路各層參數設定及說明	24
表 17模型訓練的方式	26
表 18模型訓練步驟	26
表 19模型訓練步驟	27
表 20新聞關鍵句子虛擬碼	28
表 21新聞情緒分析虛擬碼	29
表 22新聞相似分數前10名句子	32
表 23新聞文章關鍵句子DICT_SCORE	33
表 24新聞文章關鍵句子SNOWNLP_SCORE	33
表 25 股票新聞數量統計	37
表 26 股票過濾後數量統計	37
表 27實驗環境軟硬體工具清單	39
表 28 各上市公司所包含5日內漲幅量達到10% 的日期集合數量統計	39
表 29各上市公司所包含10日內漲幅量達到10% 的日期集合數量統計	39
表 30各上市公司所包含15日內漲幅量達到10% 的日期集合數量統計	39
表 31 茂矽a日內無轉移學習準確率	40
表 32 各上市公司新聞量比較圖	41
表 33目標股票:茂矽,來源股票:台積電10日的實驗結果	41
表 34 目標股票:茂矽,來源股票:台積電15日的實驗結果	41
表 35 相關係數對照表	42
表 36 各上市公司相關係數比較表	43
表 37 目標股票:茂矽,來源股票:華邦電5日的實驗結果	43
表 38 目標股票:茂矽,來源股票:華邦電10日的實驗結果	43
表 39 目標股票:茂矽,來源股票:華邦電15日的實驗結果	44
表 40 各上市公司市值比較圖	44
表 41 目標股票:茂矽,來源股票:聯電5日的實驗結果	45
表 42 目標股票:茂矽,來源股票:聯電10日的實驗結果	45
表 43 目標股票:茂矽,來源股票:聯電15日的實驗結果	45
表 44 各上市公司所包含5日內漲幅量達到10% 的實驗結果	46
表 45 各上市公司所包含10日內漲幅量達到10% 的實驗結果	46
表 46 各上市公司所包含15日內漲幅量達到10% 的實驗結果	47
表 47 使用上漲機率c %尋找最佳化累積報酬實驗結果	48
參考文獻
[1]	Siddhaling Urolagin, “Text mining of tweet for sentiment classification and association with stock prices,” 2017 International Conference on Computer and Applications, 6-7 Sept. 2017
[2]	Xi Zhang, Siyu Qu, Jieyun Huang, Binxing Fang and Philip Yu, “Stock market prediction via multi-source multiple instance learning,” IEEE Access, Vol. 6, pp. 50720-50728, 13 September 2018 
[3]	Wenjie Zhao, Gaoyu Zhang, George Yuan, Jun Liu, Hongtao Shan and Shuyi Zhang, “The study on the text classification for financial news based on partial information,” IEEE Access, Vol. 8, pp. 100426-100437, 27 May 2020 
[4]	Rui Ren, Desheng Dash Wu and Tianxiang Liu, “Forecasting stock market movement direction using sentiment analysis and support vector machine,” IEEE Systems Journal ,Vol. 13, pp. 760-770, 27 March 2018 
[5]	Xiaodong Li, Haoran Xie, Tak-Lam Wong and Fu Lee Wang, “Market impact analysis via sentimental transfer learning,” 2017 IEEE International Conference on Big Data and Smart Computing, 13-16 Feb. 2017
[6]	Qing Li, Yan Chen, Jun Wang, Yuanzhu Che and Hsinchun Chen, “Web media and stock markets : A survey and future directions from a big data perspective,” IEEE Transactions on Knowledge and Data Engineering, Vol. 30, pp. 381-399, 16 October 2017
[7]	Xiliu Man, Tong Luo and Jianwu Lin, “Financial sentiment analysis(FSA): A survey,” 2019 IEEE International Conference on Industrial Cyber Physical Systems, 01 August 2019
[8]	Chi-Han Du, Ming-Feng Tsai and Chuan-Ju Wang, “Beyond word-level to sentence-level sentiment analysis for financial reports,” 2019 IEEE International Conference on Acoustics, Speech and Signal Processing, 12-17 May 2019
[9]	Sinno Jialin Pan and Qiang Yang, “A survey on transfer learning,” IEEE Transactions on Knowledge and Data Engineering, Vol.22, pp. 1345 – 1359, 16 October 2009
[10]	Sreelekshmy Selvin, R Vinayakumar, E. A Gopalakrishnan, Vijay Krishna Menon and K. P. Soman, “Stock price prediction using LSTM, RNN and CNN-sliding window model,” 2017 International Conference on Advances in Computing, Communications and Informatics, 13-16 Sept. 2017
[11]	Bo-Sheng Lin, Wei-Tao Chu and Chuin-Mu Wang, “Application of stock analysis using Deep Learning,” 2018 7th International Congress on Advanced Applied Informatics, 8-13 July 2018
[12]	Thaloengpattarakoon Sanboon, Kamol Keatruangkamala and Saichon Jaiyen, “A Deep Learning model for predicting buy and sell recommendations in stock exchange of thailand using Long Short-Term Memory,” 2019 IEEE 4th International Conference on Computer and Communication Systems, 23-25 Feb. 2019
[13]	Christopher Chou, Junho Park and Eric Chou, “Predicting stock closing price after COVID-19 based on sentiment analysis and LSTM,” 2021 IEEE 5th Advanced Information Technology, Electronic and Automation Control Conference, 12-14 March 2021

[14]	T.-T. Teoh, W. T. Lim, K. W. Koh, J. J. Soh, T. Tan, S.Y. Liu and Y.-Y. Nguwi, “From technical analysis to text analytics: stock and indexprediction with GRU,” 2019 IEEE International Conference on Cybernetics and Intelligent Systems and IEEE Conference on Robotics, Automation and Mechatronics, 18-20 Nov. 2019
[15]	K. Choet al., “Learning phrase representations using RNN encoder–decoder for statistical machine translation”, arXiv:1406.1078 , 2014
[16]	Siddartha Mootha, Sashank Sridhar, Rahul Seetharaman and S. Chitrakala, “Stock price prediction using Bi-Directional LSTM based sequence to sequence modeling and multitask learning,” 2020 11th IEEE Annual Ubiquitous Computing, Electronics & Mobile Communication Conference, 28-31 Oct. 2020
[17]	Wang Yue and Lei Li, “Sentiment analysis using Word2vec-CNN-BiLSTM classification,” 2020 Seventh International Conference on Social Networks Analysis, Management and Security, 03 February 2021
[18]	Papis Wongchaisuwat, “Automatic keyword extraction using TextRank,” 2019 IEEE 6th International Conference on Industrial Engineering and Applications, 16 May 2019
[19]	Yujun Wen, Hui Yuan and Pengzhou Zhang “Research on keyword extraction based on Word2Vec weighted TextRank” 2016 2nd IEEE International Conference on Computer and Communications, 14-17 Oct. 2016
[20]	Xiaodong Li, Haoran Xie, Raymond Y. K. Lau, Tak-Lam Wong and Fu-Lee WangStock, “Prediction via sentimental Transfer Learning,” IEEE Access, Vol. 6, pp. 73110-73118, 16 November 2018
[21]	P. Wang, Y. Luo, Z. Chen, L. He and Z. Zhang, “Orientation analysis for chinese news based on word embedding and syntax rules,” IEEE Access, Vol. 7, pp. 159888-15898, 2019
[22]	T. Loughran and B. Mcdonald, “When is a liability not a liability? Textual analysis, dictionaries, and 10‐Ks,” The Journal of finance, vol. 66, issue 1, 35-65, 2011
論文全文使用權限
校內
校內紙本論文延後至2026-06-25公開
同意電子論文全文授權校園內公開
校內電子論文延後至2026-06-25公開
校內書目立即公開
校外
同意授權
校外電子論文延後至2026-06-25公開

如有問題,歡迎洽詢!
圖書館數位資訊組 (02)2621-5656 轉 2487 或 來信