張舒雅 王占剛
摘 要:使用樸素貝葉斯分類算法,結(jié)合Spark內(nèi)存計算框架,對用戶觀看視頻及次數(shù)信息進行分析,建立用戶性別和年齡區(qū)間的分類模型;然后利用特征項的權(quán)重優(yōu)化模型,考慮到每個特征項在各個類別中的權(quán)重對分類結(jié)果的影響,提出了一種基于特征項與類別間相關(guān)性的TFC-IDFC權(quán)重計算方法,并與傳統(tǒng)的TF-IDF權(quán)重計算方法進行比較,通過正確率和F1值兩個指標,證明考慮到特征項與類別的相關(guān)性所提出的TFC-IDFC權(quán)重使得分類模型的分類能力更好。
關(guān)鍵詞:Spark;用戶特征;貝葉斯;分類;TF-IDF
中圖分類號:TP391 文獻標識碼:A
1 引言(Introduction)
隨著互聯(lián)網(wǎng)的快速發(fā)展,用戶的數(shù)量飛速增加,用戶屬性更加多元化,大數(shù)據(jù)的應(yīng)用與創(chuàng)新成為一個重要的關(guān)注點。通過用戶的網(wǎng)絡(luò)行為,分析用戶的特征,無論在理論研究中還是實際應(yīng)用中,都是一個熱門話題。大數(shù)據(jù)用戶特征分析,整合海量用戶數(shù)據(jù),將用戶標簽化,使得計算機能夠程序化處理與人相關(guān)的信息,通過機器學習算法、模型能夠“理解”人。深度分析用戶特征,在理論研究上可以更好地挖掘事件關(guān)聯(lián)及預(yù)測事件;對于企業(yè)而言,無論是搜索引擎、推薦系統(tǒng)、廣告投放等各種應(yīng)用領(lǐng)域,都可以進一步提高獲取信息的精準度和效率。
而Spark作為一種基于內(nèi)存計算的分布式計算框架,正受到越來越多大數(shù)據(jù)研究者的關(guān)注。它提供了一個更快、更通用的數(shù)據(jù)處理平臺,通過將大量數(shù)據(jù)集計算任務(wù)分配到多臺計算機上,并且將中間過程的輸出結(jié)果保存在內(nèi)存中,不再需要讀取和寫入HDFS,以提供高效內(nèi)存計算,因此Spark可以更好的應(yīng)用于大數(shù)據(jù)挖掘和機器學習等算法[1-3]。同時Spark引入了彈性分布式數(shù)據(jù)集(RDD,Resilient Distributed Dataset)。RDD是不可變的、容錯的、分布式對象集合,用戶可以利用RDD的操作函數(shù)并行地操作該集合,以提高計算速度。
目前國內(nèi)用戶特征分析的研究主要是對社交網(wǎng)絡(luò)、微博評論、日志數(shù)據(jù)等進行特征分析,少部分人則對視頻數(shù)據(jù)進行分析。張巖峰等人通過用戶在微博上的言論、行為和社交圈等公開數(shù)據(jù)信息,提出了對該用戶的個性化維度進行分類分析的方法[4];張宏鑫等人從海量移動終端日志數(shù)據(jù)中挖掘用戶特征,提出了一種基于日志數(shù)據(jù)的用戶特征分析方法[5];李冰利用用戶觀看新聞類視頻數(shù)據(jù),并通過用戶行為分析和建模處理,挖掘用戶在類別、國別、年代、熱度值、評分等維度的興趣偏好[6];馮婷婷通過用戶瀏覽視頻的行為,利用支持向量機、邏輯回歸等分類器進行性別推理[7]。
國際上,Das S等人通過終端用戶的特征標簽,提出了基于權(quán)重的邏輯回歸算法的監(jiān)督和半監(jiān)督學習的用戶特征分析[8];Kim H L等人提出通過分析用戶標簽,實現(xiàn)以用戶興趣為中心的聚類[9];Gulsen E等人利用網(wǎng)絡(luò)日志數(shù)據(jù),使用url、DMOZ和文本內(nèi)容三個特征數(shù)據(jù)集,預(yù)測性別[10]。
目前利用用戶觀看視頻信息分析用戶特征的研究成果還比較少。本研究利用用戶觀看視頻及次數(shù)信息,基于樸素貝葉斯分類算法[11-15]和Spark內(nèi)存計算框架,訓(xùn)練用戶性別與年齡區(qū)間的分類模型,其中年齡區(qū)間分為19歲以下、19—30歲、31—40歲、41—50歲和50歲以上,通過計算每個特征項在各個類別中的權(quán)重優(yōu)化模型,提高分類結(jié)果的正確率。
4 結(jié)論(Conclusion)
本文利用用戶觀看視頻的數(shù)據(jù),將樸素貝葉斯分類算法應(yīng)用到Spark計算框架,訓(xùn)練用戶的性別和年齡區(qū)間的分類模型、加載模型,對測試樣本進行分類,比較分類結(jié)果與標注標簽,分析模型性能,整個過程耗時大約三分鐘。在實驗過程中,未考慮特征項權(quán)重的分類效果不是很理想;在樸素貝葉斯分類算法中加入傳統(tǒng)的TF-IDF權(quán)重計算方法,分類效果僅有小幅度提升;其原因是TF-IDF權(quán)重考慮的是特征項與整個樣本集的相關(guān)性,并沒有考慮到特征項與類別的相關(guān)性,給出的特征項權(quán)重并不準確,因此文本提出了一種改進的基于特征項與類別間相關(guān)性的TFC-IDFC權(quán)重計算方法。該算法的思想是某個特征項在各個類別間出現(xiàn)的越不均勻,則區(qū)分類別的能力越強,權(quán)重越大,也就意味著每個特征項在各個類別中的權(quán)重在很大程度上影響了樸素貝葉斯分類算法的分類能力;另外,通過實驗也證明改進的TFC-IDFC權(quán)重計算方法,增加對類別重要程度較大的特征項的權(quán)重,有利于提高分類模型的質(zhì)量和分類結(jié)果的正確率,分類效果有了明顯的提高。
大數(shù)據(jù)背景下的用戶特征分析是當前的研究熱點,用戶的一切網(wǎng)絡(luò)行為都是值得挖掘的對象。在最短的時間內(nèi),能夠?qū)τ脩舾訙蚀_分析是我們的研究目標。采用更多維度、更大量級的數(shù)據(jù)信息,對用戶更多特征的分析將是下一步的研究重點。
參考文獻(References)
[1] Zhang F,et al.A Distributed Frequent Itemset Mining Algorithm Using Spark for Big Data Analytics[J].Cluster Computing,2015,18(4):1493-1501.
[2] Semberecki P,Maciejewski H.Distributed Classification of Text Documents on Apache Spark Platform[C].International Conference on Artificial Intelligence and Soft Computing.Springer International Publishing,2016:621-630.
[3] Meng X,et al.Mllib:Machine Learning in Apache Spark[J].JMLR,2016,17(34):1-7.
[4] ZHANG Yanfeng,et al.A Micro-Blog User Personality Classification Analysis[J].Computer Engineering and Science,2015,37(2):402-409.
[5] ZHANG Hongxin,et al.Visualization of Crowd Characteristics Based on Mobile terminal log data[J].Journal of Software,2016,27(5):1230-1245.
[6] LI Bing.Design and Implementation of Personalized Video Recommendation System based on Hadoop[D].Beijing University of Technology,2015.
[7] Feng T,et al.Tags and Titles of Videos you Watched Tell Your Gender[C].ICC 2014 IEEE International Conference on Communications,2014:1837-1842.
[8] Das S,et al.End-User Feature Labeling: Supervised and Semi-supervised Approaches Based on Locally-Weighted Logistic Regression[J].Artificial Intelligence,2013,204(9):56-74.
[9] Kim H L,et al.Mining and Representing User Interests:The Case of Tagging Practices[J].Systems Man & Cybernetics Part A Systems & Humans IEEE Transactions on,2011,41(4):683-692.
[10] Gulsen E,et al.Big Data Feature Selection and Projection for Gender Prediction Based on User Web Behaviour[C].Signal Processing and Communications Applications Conference (SIU),2015 23th.IEEE,2015:1545-1548.
[11] Luo X,et al.Improvement of Automatic Chinese Text Classification by Combining Multiple Features[J].IEEJ Transactions on Electrical and Electronic Engineering,2015,10(2):166-174.
[12] Lee C H.A Gradient Approach for Value Weighted Classification Learning in Naive Bayes[J].Knowledge-Based Systems,2015,85(C):71-79.
[13] Bi W,Kwok J T.Bayes-Optimal Hierarchical Multilabel Classification[J].IEEE Transactions on Knowledge and Data Engineering,2015,27(11):2907-2918.
[14] Kim H K,Kim M.Model-Induced Term-Weighting Schemes for Text Classification[J].Applied Intelligence,2016:1-14.
[15] Vicente M,Batista F,Carvalho J P.Twitter Gender Classification Using User Unstructured Information[C].Fuzzy Systems(FUZZ-IEEE),2015 IEEE International Conference on.IEEE,2015:1-7.
[16] McCallum A,Nigam K.A Comparison of Event Models for Naive Bayes Text Classification[C].AAAI-98 Workshop on Learning for Text Categorization,1998,752:41-48.
[17] Peralta D,et al.Evolutionary Feature Selection for Big Data Classification:A MapReduce Approach[J].Mathematical Problems in Engineering,2015,12(05):301-305.
[18] LIANG Hong,XU Nanshan,LU Lingang.Sina Micro-blog Users Characteristics Analysis[J].Computer Engineering and Applications,2015,51(7):141-148.
[19] Bozkurt O O,Taygi Z C.Audio-Based Gender and Age Identification[C].Signal Processing and Communications Applications Conference,2014:1371-1374.
[20] Pentreath N.Machine Learning with Spark:Create Scalable Machine Learning Applications to Power a Modern Data-Driven Business Using Spark[M].Packt Publishing,2015.
[21] Hu W,et al.Tagpref:User Preference Modeling by Social Tagging[C].Proceedings of the 2013 IEEE 10th International Conference on Ubiquitous Intelligence & Computing and 2013 IEEE 10th International Conference on Autonomic & Trusted Computing.IEEE Computer Society,2013:111-118.
[22] Sun X,Lin H.Topical Community Detection from Mining User Tagging Behavior and Interest[J].Journal of the American Society for Information Science & Technology,2013,64(2):321-333.
[23] Wang Z,et al.Analysis of User Behaviors by Mining Large Network Data Sets[J].Future Generation Computer Systems,2014,37(7):429-437.
[24] Han Y,Xia K.Data Preprocessing Method Based on User Characteristic of Interests for Web Log Mining[C].Instrumentation and Measurement, Computer,Communication and Control(IMCCC),2014 Fourth International Conference on.IEEE,2014:867-872.
[25] Bai S,et al.Predicting Big Five Personality Traits of Microblog Users[C].2013 IEEE/WIC/ACM International Joint Conferences on Web Intelligence(WI)and Intelligent Agent Technologies(IAT).IEEE Computer Society,2013:501-508.
作者簡介:
張舒雅(1989-),女,碩士生.研究領(lǐng)域:大數(shù)據(jù)挖掘.
王占剛(1975-),男,博士,副教授.研究領(lǐng)域:大數(shù)據(jù),計算
機檢測應(yīng)用,計算機網(wǎng)絡(luò)安全.