







摘要: 為提高短文本語義相似性度量準確性, 設計一種基于混合機器學習模型的短文本語義相似性度量算法. 先對短文本實施預處理, 基于混合機器學習模型構建短文本的字詞向量模型, 對短文本進行特征擴展; 然后組合短文本的多樣度量特征, 對多樣度量特征進行維度規約; 最后通過構建一個集成學習模型, 計算語義相似性結果, 實現語義相似性的度量. 使用“Quora Question Pairs”比賽數據集測試該方法的性能, 測試結果表明, 該方法的準確性較高, 對數損失和度量均方差均較低, 說明該方法的相似性度量準確性較高.
關鍵詞: 混合機器學習模型; 短文本; 文本分詞; 語義相似性; 卡方檢驗; 相似性度量
中圖分類號: TP391 文獻標志碼: A 文章編號: 1671-5489(2023)04-0909-06
Short Text Semantic Similarity Measurement Algorithm Based on Hybrid Machine Learning Model
HAN Kaixu1, YUAN Shufang2
(1. College of Electronics and Information Engineering, Beibu Gulf University,
Qinzhou 535011, Guangxi Zhuang Autonomous Region, China;
2. College of Sciences, Beibu Gulf University, Qinzhou 535011, Guangxi Zhuang Autonomous Region, China)
Abstract: In order to improve the accuracy of short text semantic similarity measurement, we designed a short text semantic similarity measurement algorithm based on a hybrid machine learning model. Firstly, we preprocessed the short text, constructed a word vector model of the short text based on the hybrid machine learning model, and extended the" features of the short text. Secondly, we" combined the various metric features of the short text, implemented dimensional reduction on the various metric features. Finally, we constructed an ensemble learning" model to calculate the semantic similarity results and achieve the" semantic similarity measurement. We tested the performance of the method by using the “Quora Question Pairs” competition dataset, the test results show that the accuracy of the" method is high, the logarithmic loss, and the measurement mean square error are both low, indicating that the similarity measurement accuracy of the method is high.
Keywords: hybrid machine learning model; short text; text segmentation; semantic similarity; Chi-square test; similarity measurement
短文本雖然文本較短, 但其內容能容納很微妙的語言表達, 在很多實際應用中, 都需要批量處理短文本數據[1]. 但對于大規模數據, 通常難以分辨短文本的語義相似性, 基于該背景對短文本語義相似性度量問題進行研究.
在自然語言處理技術中, 文本相似性度量一直是研究重點. 文本相似性度量的傳統算法更適合在長文本上應用, 對于短文本常無法取得滿意的效果, 因此需要對短文本相似性度量進行專門研究. 目前, 關于該問題的研究已有許多成果. 石彩霞等[2]提出了一種準確率較高的短文本語義相似性度量算法, 從短文本的稀疏特性出發, 通過多重檢驗加權融合實現相似性度量, 并取得了合理準確的計算結果. 本文應用混合機器學習模型對該問題進行研究, 設計一種基于混合機器學習模型的短文本語義相似性度量算法, 以實現更準確的相似性度量.
1 算法設計
1.1 短文本預處理
2.3 實驗結果與分析
首先將數據集中的數據平均分成5份, 在每份數據中隨機劃分出80%作為訓練集, 剩下的數據作為測試集. 在不同的提取特征數量下分別對訓練集和測試集的Accuracy數值進行測試, 測試結果如圖4所示. 由圖4可見, 在不同的提取特征數下, 本文方法的Accuracy數值都較高, 說明該方法的短文本語義相似性度量準確率較高. 在提取特征數為3時, 訓練集和測試集的Accuracy數值最高.
其次分別對訓練集和測試集的Log loss數值進行測試, 測試結果如圖5所示. 由圖5可見, 本文方法訓練集和測試集的Log loss數值均較低, 說明該方法在語義相似性度量中的對數損失較低, 度量性能較好.
最后對設計方法的度量均方差進行測試, 測試結果列于表2. 由表2可見, 通過該方法進行短文本語義相似性度量后, 訓練集和測試集的度量均方差都較低, 表明本文方法的度量準確率較高.
綜上所述, 本文在對短文本語義相似性度量問題進行研究的過程中, 應用了混合卷積神經網絡學習模型和全連接神經網絡學習模型的混合機器學習模型, 設計了一種基于混合機器學習模型的短文本語義相似性度量算法, 經過測試其在Accuracy,Log loss和度量均方差3個指標上均較優, 提高了短文本相似性度量準確率, 有一定的應用價值.
參考文獻
[1]鄭志蘊, 吳建萍, 李鈍, 等. 一種基于短文本相似度計算的知識子圖融合方法 [J]. 小型微型計算機系統, 2020, 41(1): 6-11. (ZHENG Z Y, WU J P, LI D, et al. A Knowledge Subgraph Fusion Method Based on Short Text Similarity Calculation [J]. Small Microcomputer Systems, 2020, 41(1): 6-11.)
[2]石彩霞, 李書琴, 劉斌. 多重檢驗加權融合的短文本相似度計算方法 [J]. 計算機工程, 2021, 47(2): 95-102. (SHI C X, LI S Q, LIU B. Short Text Similarity Calculation Method Based on Weighted Fusion of Multiple Tests [J]. Computer Engineering, 2021, 47(2): 95-102.)
[3]趙雅欣, 鄭明洪, 石林鑫, 等. 面向電力審計領域的兩階段短文本分類方法研究 [J]. 西南大學學報(自然科學版), 2020, 42(10): 1-7. (ZHAO Y X, ZHENG M H, SHI L X, et al. Research on Two-Stage Short Text Classification Method for Electric Power Auditing [J]. Journal of Southwest University (Natural Science Edition), 2020, 42(10): 1-7.)
[4]寇菲菲, 杜軍平, 石巖松, 等. 面向搜索的微博短文本語義建模方法 [J]. 計算機學報, 2020, 43(5): 781-795. (KOU F F, DU J P, SHI Y S, et al. A Search-Oriented Approach to Semantic Modeling of Microblog Short Texts [J]. Chinese Journal of Computers, 2020, 43(5): 781-795.)
[5]唐善成, 張雪, 張鏷月, 等. 融合中文字形和字義的字向量表示方法 [J]. 科學技術與工程, 2021, 21(32): 13787-13792. (TANG S C, ZHANG X, ZHANG P Y, et al. A Word Vector Representation Method Integrating Chinese Character Shape and Character Meaning [J]. Science Technology and Engineering, 2021, 21(32): 13787-13792.)
[6]陶玥, 余麗, 吳振新. CoTransH: 科技文獻知識圖譜中語義關系預測的翻譯模型 [J]. 情報理論與實踐, 2021, 44(11): 187-196. (TAO Y, YU L, WU Z X. CoTransH: A Translation Model for Semantic Relationship Prediction in Knowledge Graphs of Scientific and Technological Documents [J]. Information Theory and Practice, 2021, 44(11): 187-196.)
[7]葉俊民, 羅達雄, 陳曙. 基于短文本情感增強的在線學習者成績預測方法 [J]. 自動化學報, 2020, 46(9): 1927-1940. (YE J M, LUO D X, CHEN S. Online Learner Performance Prediction Method Based on Short Text Sentiment Enhancement [J]. Journal of Automation, 2020, 46(9): 1927-1940.)
[8]高云龍, 吳川, 朱明. 基于改進卷積神經網絡的短文本分類模型 [J]. 吉林大學學報(理學版), 2020, 58(4): 923-930. (GAO Y L, WU C, ZHU M. Short Text Classification Model Based on Improved Convolutional Neural Network [J]. Journal of Jilin University (Science Edition), 2020, 58(4): 923-930.)
[9]湯凌燕, 熊聰聰, 王嫄, 等. 基于深度學習的短文本情感傾向分析綜述 [J]. 計算機科學與探索, 2021, 15(5): 794-811. (TANG L Y, XIONG C C, WANG Y, et al. A Review of Short Text Sentiment Analysis Based on Deep Learning [J]. Computer Science and Exploration, 2021, 15(5): 794-811.)
[10]饒毓和, 凌志浩. 一種結合主題模型與段落向量的短文本聚類方法 [J]. 華東理工大學學報(自然科學版), 2020, 46(3): 419-427. (RAO Y H, LING Z H. A Short Text Clustering Method Combining Topic Model and Paragraph Vector [J]. Journal of East China University of Science and Technology (Natural Science Edition), 2020, 46(3): 419-427.)
[11]劉嬌, 李艷玲, 林民. 膠囊網絡用于短文本多意圖識別的研究 [J]. 計算機科學與探索, 2020, 14(10): 1735-1743. (LIU J, LI Y L, LIN M. Research on Capsule Networks for Multi-intent Recognition of Short Texts [J]. Computer Science and Exploration, 2020, 14(10): 1735-1743.)
[12]繆亞林, 姬怡純, 張順, 等. CNN-BiGRU模型在中文短文本情感分析的應用 [J]. 情報科學, 2021, 39(4): 85-91. (MIAO Y L, JI Y C, ZHANG S, et al. Application of CNN-BiGRU Model in Sentiment Analysis of Chinese Short Texts [J]. Information Science, 2021, 39(4): 85-91.)
[13]張博, 孫逸, 李孟穎, 等. 基于遷移學習和集成學習的醫學短文本分類 [J]. 山西大學學報(自然科學版), 2020, 43(4): 947-954. (ZHANG B, SUN Y, LI M Y, et al. Classification of Medical Short Texts Based on Transfer Learning and Ensemble Learning [J]. Journal of Shanxi University (Natural Science Edition), 2020, 43(4): 947-954.)
[14]孫洋, 粟栗, 張星, 等. 基于子語義空間的挖掘短文本策略方法 [J]. 電信科學, 2020, 36(3): 83-92. (SUN Y, SU L, ZHANG X, et al. Strategy Method for Mining Short Text Based on Sub-semantic Space [J]. Telecommunications Science, 2020, 36(3): 83-92.)
[15]宋明, 劉彥隆. Bert在微博短文本情感分類中的應用與優化 [J]. 小型微型計算機系統, 2021, 42(4): 714-718. (SONG M, LIU Y L. Application and Optimization of Bert in Microblog Short Text Sentiment Classification [J]. Small Microcomputer System, 2021, 42(4): 714-718.)
[16]王生生, 張航, 潘彥岑. 改進的和積網絡自動編碼器及短文本情感分析應用 [J]. 哈爾濱工程大學學報, 2020, 41(3): 411-419. (WANG S S, ZHANG H, PAN Y C. Improved Sum-Product Network Autoencoder and Short Text Sentiment Analysis Application [J]. Journal of Harbin Engineering University, 2020, 41(3): 411-419.)
(責任編輯: 韓 嘯)
收稿日期: 2022-04-15.
第一作者簡介: 韓開旭(1984—), 男, 漢族, 博士, 講師, 從事機器學習和自然語言處理的研究, E-mail: frog0696@163.com. 通信作者簡介: 袁淑芳(1988—), 女, 漢族, 碩士, 助理研究員, 從事機器學習的研究, E-mail: ysf20210605@126.com.
基金項目: 國家自然科學基金面上項目(批準號: 61374127)和廣西高校中青年教師科研基礎能力提升項目(批準號: 2021KY0434; 2020KY10019).