Another Twitter sentiment analysis with Python — Part 11 (CNN + Word2Vec)

Another Twitter sentiment analysis with Python — Part 11 (CNN + Word2Vec)

ID:40707469

大小:2.07 MB

页数:19页

时间:2019-08-06

Another Twitter sentiment analysis with Python — Part 11 (CNN + Word2Vec)_第1页
Another Twitter sentiment analysis with Python — Part 11 (CNN + Word2Vec)_第2页
Another Twitter sentiment analysis with Python — Part 11 (CNN + Word2Vec)_第3页
Another Twitter sentiment analysis with Python — Part 11 (CNN + Word2Vec)_第4页
Another Twitter sentiment analysis with Python — Part 11 (CNN + Word2Vec)_第5页
资源描述:

《Another Twitter sentiment analysis with Python — Part 11 (CNN + Word2Vec)》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库

1、TheRickest RickyFollowIamadatascientist.Period.Feb23·14minreadAnotherTwittersentimentanalysiswithPython—Part11(CNN+Word2Vec)Thisisthe11thandthelastpartofmyTwittersentimentanalysisproject.Ithasbeenalongjourney,andthroughmanytrialsanderrorsalongtheway,Ihavelearnedcountlessvaluablelessons.Ihaven’t

2、decidedonmynextproject.ButIwilldenitelymaketimetostartanewproject.Youcanndthepreviouspostsfromthebelowlinks.•Part1:Datacleaning•Part2:EDA,Datavisualisation•Part3:Zipf’sLaw,Datavisualisation•Part4:Featureextraction(countvectorizer),N-gram,confusionmatrix•Part5:Featureextraction(Tdfvectorizer)

3、,machinelearningmodelcomparison,lexicalapproach•Part6:Doc2Vec•Part7:Phrasemodeling+Doc2Vec•Part8:Dimensionalityreduction(Chi2,PCA)•Part9:NeuralNetworkswithTdfvectors•Part10:NeuralNetworkswithDoc2Vec/Word2Vec/GloVe*InadditiontoshortcodeblocksIwillattach,youcanndthelinkforthewholeJupyterNoteboo

4、kattheendofthispost.PreparationforConvolutionalNeuralNetworkInthelastpost,Ihaveaggregatedthewordvectorsofeachwordinatweet,eithersummationorcalculatingmeantogetonevectorrepresentationofeachtweet.However,inordertofeedtoaCNN,wehavetonotonlyfeedeachwordvectortothemodel,butalsoinasequencewhichmatche

5、stheoriginaltweet.Forexample,let’ssaywehaveasentenceasbelow.“Ilovecats”Andlet’sassumethatwehavea2-dimensionalvectorrepresentationofeachwordasfollows:I:[0.3,0.5]love:[1.2,0.8]cats:[0.4,1.3]Withtheabovesentence,thedimensionofthevectorwehaveforthewholesentenceis3X2(3:numberofwords,2:numberofvector

6、dimension).Butthereisonemorethingweneedtoconsider.Aneuralnetworkmodelwillexpectallthedatatohavethesamedimension,butincaseofdierentsentences,theywillhavedierentlengths.Thiscanbehandledwithpadding.Let’ssaywehaveoursecondsentenceasbelow.“Ilovedogstoo”withthebelowvectorrepresentationofeachword:I:

7、[0.3,0.5],love:[1.2,0.8],dogs:[0.8,1.2],too:[0.1,0.1]Therstsentencehad3X2dimensionvectors,butthesecondsentencehas4X2dimensionvector.Ourneuralnetworkwon’taccepttheseasinputs.Bypaddingtheinputs,wedecidethemaximumlengthofwordsinasen

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。