SlideShare une entreprise Scribd logo
1  sur  56
大數據情緒分析的經驗分享
清華大學資工系 陳宜欣
About Speaker
陳宜欣 Yi-Shin Chen
▷ Currently
• 清華大學資訊工程系副教授
• 主持智慧型資料工程與應用實驗室 (IDEA Lab)
▷ Education
• Ph.D. in Computer Science, USC, USA
• M.B.A. in Information Management, NCU, TW
• B.B.A. in Information Management, NCU, TW
▷ Current Research
• 音樂治療+人工智慧
• 文字資料的情緒分析、精神分析
2
Help?
3
文字情緒分析
正統 …
4
語言分析
▷Noam Chomsky
• “a language to be a set (finite or infinite) of
sentences, each finite in length and
constructed out of a finite set of elements”
• “the structure of language is biologically
determined”
• “that humans are born with an innate linguistic
ability that constitutes a Universal Grammar
will also be examined”
→ Syntactic Structures 句法結構
5
Noam Chomsky
(1928 - current)
Basic Concepts in NLP
6
This is the best thing happened in my life.
Det. Det. NN PNPre.Verb VerbAdj
辭彙分析
Lexical analysis
(Part-of Speech
Tagging 詞性標註)
句法分析
Syntactic analysis
(Parsing)
This? (t1)
Best thing (t2)
My (m1)
Happened (t1, t2, m1)
語意分析
Semantic Analysis
Happy (x) if Happened (t1, ‘Best’, m1) Happy
推理 Inference
(Emotion Analysis)
Noun Phrase
Prep Phrase
Prep Phrase
Noun Phrase
Sentence
正統自然語言處理法
▷分析字的詞性
▷了解字的意義
▷了解字詞間的關聯、規則
 可以了解文句間的意義
 精確度高
 需要蒐集辭典與標記過的字詞關聯
 字詞間的關聯還會被相對位置影響
 換個語言就要重新蒐集一次
7
太難了!
Chomsky代表作在1957年誕生
跟他大女兒同一年
8
從經驗中學習
小孩教我們的事情
9
情緒的表達
▷是小細節與創意的累積
• 很多小細節會被傳統方法忽略
▷充滿錯誤
▷常常沒什麼邏輯
10
你總是叫我收玩具
我永遠不能電視看了
對你的回憶,一切語言都顯得蒼白無力。
生氣 難過 開心
字典通常只記載對的字
推理通常也需有邏輯
孩子是
我們的
老師
一個媽媽的喃喃自語
▷我家小孩怎麼判斷生氣?怎麼表達情緒?
• 即使沒讓孩子看到臉
• 也沒更改說話的語調
• 為什麼小孩通常都是對的?
▷我猜
• 一歲的孩子還不懂語法
• 一歲的孩子還沒背過詞典
• 媽媽生氣的時候應該是詞不達義的
所以,
目標是:
11
而且不
花錢
Free Data
▷免費數據(通常很髒)
▷Subconscious Crowdsourcing
12
“computers/companies/product-support/apple”
“鹿茸 馬”, “馬卡茸”, “水母” in search log
Ontology Construction
“School day again #sad”
Emotion Analysis
Subconscious Crowdsourcing
▷Crowdsourcing
• Merriam-Webster: Obtaining needed services, ideas,
or content by soliciting contributions from a large
group of people, especially an online community
▷群眾的潛意識智慧
• 從人們的日常紀錄中,擷取共同潛意識
Chun-Hao Chang, Elvis Saravia and Yi-Shin Chen, Subconscious Crowdsourcing: A Feasible Data Collection
Mechanism for Mental Disorder Detection on Social Media, The 2016 IEEE/ACM International Conference on
Advances in Social Networks Analysis and Mining (ASONAM 2016), San Francisco, CA, USA, 18 - 21 August, 2016
13
很貴
不花
錢
潛意識情緒大資料
▷Twitter, 目前最容易大量下載的資料
Throwing my phone always calms me down #anger
My sister always makes things look much more worse than they seem >:[ #anger
Why my brother always crabby !?!? #rude #youranadult #anger #issues
WHY DOES MY COMPUTER ALWAYS FREEZE??? NEVER FAILS. #anger
Im wanna crazy,if my life always sucks like this. #anger
Hashtag和表情符號最能標註情緒,所以可以當成人工標記的答案
14
文字情緒分析
非正統
15
潛意識情緒資料
16
潛意識情緒資料
17
潛意識情緒資料 等等!
還要有
對照組
18
非情緒資料
19
非情緒資料
20
非情緒資料
21
資料蒐集後的前處理
▷重點:拿掉麻煩的、不會處理的
o Too short
→ 短到拿不到特徵
o Contain too many hashtags
→ 資訊太多很難處理
o Are retweets
→ 會增加計算複雜度
o Have URLs
→ 還要再抓一次資料,這樣太累了
o Convert user mentions to <usermention> and hashtags to
<hashtag>
→ 消去識別碼, 不能偷看答案
反正是
大數據
22
處理原則
▷找出『實驗組』和『對照組』的相同、相異處
• 分析字詞出現的頻率
→ TF•IDF (Term frequency, inverse document frequency)
• 分析字詞互相伴隨出現的頻率
→ Co-occurrence
• 比較字詞間的重要關係程度
→ Centrality Graph
23
Graph Construction
▷建立兩種圖(情緒圖 & 非情緒圖)
• E.g.
→情緒文字:I love the World of Warcraft new game 
→ 非情緒文字: 3,000 killed in the world by ebola
I
of
Warcraft
new
game
WorldLove
the
0.9
0.84
0.65
0.12
0.12
0.53
0.67

0.45
3,000
world
by
ebola
the
killed in
0.49
0.87
0.93
0.83
0.55
0.25 24
圖型處理
▷將兩種圖型相同的地方剔除
• 留下情緒圖才有的特徵
▷接下來分析哪些字是所謂的中心點 (中心字)
• Betweenness, Closeness, Eigenvector, Degree, Katz
→ 都有免費軟體可以使用, e.g, Gaphi, GraphDB
▷再分析哪一些字常一起被使用(社區字)
• Clustering Coefficient
Graph重要
字詞
25
去蕪存菁
留下圖型中的重要字詞
→重組成情緒特徵
26
情緒特徵
o由兩種元素組成:
o Surface tokens: hello, , lol, house, …
o 替代字元: * (matches every word)
o一個情緒特徵由至少兩種元素組成
o 每一類型的元素至少要有一個
Examples:
27
情緒形態 Matches
* this * “Hate this weather”, “love this drawing”
* *  “so happy ”, “to me ”
luv my * “luv my gift”, “luv my price”
* that “want that”, “love that”, “hate that”
情緒特徵組成
o 每個情緒特徵由數個實例組合而成
o 每個實例至少要有兩個以上的 中心字 與 社區字
o 至少要各一個 中心字 和 社區字
Examples
28
社區字
love
hate
gift
weather
…
中心字
this
luv
my

…
Instances
“hate this weather”
“so happy ”
“luv my gift”
“love this drawing”
“luv my price”
“to me 
“kill this idiot”
“finish this task”
情緒特徵組成(2)
o找出所有實例的對應頻率
o根據中心字以及其出現的位置,對實例分組
29
Instances Count
“hate this weather” 5
“so happy ” 4
“luv my gift” 7
“love this drawing” 2
“luv my price” 1
“to me ” 3
“kill this idiot” 1
“finish this task” 4
Groups Cou
nt
“Hate this weather”, “love this drawing”, “kill this idiot”,
“finish this task”
12
“so happy ”, “to me ” 7
“luv my gift”, “luv my price” 8
… …
情緒特徵組成(3)
o替換所有的社區字成為替代字元
o保留中心字
o過濾不常出現的情緒特徵
30
Pattern Groups Cou
nt
* this * “Hate this weather”, “love this drawing”, “kill this idiot”, “finish this task” 12
* *  “so happy ”, “to me ” 7
luv my * “luv my gift”, “luv my price” 8
… … …
情緒特徵排序
▷ 將情緒特徵排序
• 根據頻率、情緒專屬性、多元性
• 每一種情緒都有專屬的特徵排序
悲傷快樂 生氣
31
情緒特徵結果抽樣
悲傷快樂 生氣
finally * my
tomorrow !!! *
<hashtag> birthday .+
* yay !
:) * !
princess *
* hehe
prom dress *
memories *
* without my
sucks * <hashtag>
* tonight :(
* anymore ..
felt so *
. :( *
* :((
my * always
shut the *
teachers *
people say *
-.- *
understand why *
why are *
with these *
32
情緒分類正確率
33
Naïve Bayes SVM NRCWE Our Approach
English 81.90% 76.60% 35.40% 81.20%
Spanish 70.00% 52.00% 0.00% 80.00%
French 72.00% 61.00% 0.00% 84.00%
0.00%
10.00%
20.00%
30.00%
40.00%
50.00%
60.00%
70.00%
80.00%
90.00%
100.00%
Accuracy
使用情緒
詞典
無情緒詞典
以此類推…
中文情緒分析
34
萬能的臉書大神
▷Facebook Graph API
• 粉絲頁文章
• 文章留言
▷尋找有回應表情符號的留言
35
中文贅字處理
▷超過三個以上的贅字,視同是三個贅字
36
喔,我來做。
喔喔,我來做。
喔喔喔,我來做。
喔喔喔喔,我來做。
Meaning
正面回應
中性回應
負面回應
Sentence
中文詞彙合併
▷中文詞彙通常由兩個、三個、四個字組成
▷算出不同字詞的頻率
▷較短字詞的頻率需減掉較長字詞的頻率
什麼 1025
憑什麼 600
什麼東西 200
1025-600-200=225
中文情緒元素
38
社區字 道歉、浪費、腦殘、可憐的、太誇張、太扯了、欺負弱小、
腦袋有洞、無恥之徒
中心字 真是、好了、不如、你們這、給你們、有本事、哈哈哈、
有報應的、真她媽的
中文情緒特徵
39
悲傷
HA
HA
生氣
* * 哈哈哈
國民黨 * *
黨產 * *
* * 政府
* * 一樣
* * * @u 這
有梗 * *
柯P * *
小白 * *
心疼 * *
希望 * *
天使 * *
早日康復 * * *
下輩子 * *
無辜 * *
* *,願
台灣 * *
法官 * *
女的 * *
憑什麼 * *
* * *道歉
* * 民進黨
* * 這位
到底 * *
* * 房東
* * 真的
還是 * *
* * @u 你看
好可愛 @u * *
肥貓 * *
子彈 * *
* * 太強
WOW
2016/6
情緒暗語分析
Context or not in context
40
社會標準
▷情緒表達和社會標準可能有關聯
41
182413
51866
5719 6435
112944
13085 22660
116421
開心 信任 恐懼 驚訝 悲傷 憎恨 生氣 期待
憎恨情緒的暗語(Code Word)
▷Code Word: “a word or phrase that has a secret meaning or
that is used instead of another word or phrase to avoid
speaking directly” Merriam-Webster
▷舉例:
42
Anyone who isn’t white doesn’t deserve to live here.
Those foreign ________ should be deported.niggers
已知的 憎恨字眼,容易辨識
animals
改用不挑釁的字眼,可以靠著推理得出Skype 不是通訊軟體名稱嗎?
skypes
從上下文應該會覺得不太對
暗語偵測
▷自動偵測不在字典中的暗語
▷利用已知仇恨字的上下文來擴展仇恨字詞庫
43
仇恨資料集
44
非仇恨資料
45
過濾含仇恨
字詞的語句
上下文
▷Relatedness 關聯性
• with word2vec
▷Similarity 相似性
• with dependency2vec
46
the man jumps
boy plays
talks
Relatedness: word collocation
Similarity:behaviour
不同資料的上下文關聯
▷輸入: Skypes
47
相似性關聯性
仇恨資料
非仇恨資料
skyped
facetime
Skype-ing
phone
whatsapp
line
snapchat
imessage
chat
dropbox
kike
Line
cockroaches
negroes
facebook
animals
擴充仇恨暗語
▷利用PageRank的概念來尋找相鄰字
• 利用不同資料集的差異來排序
48
niggersfaggots
monkeys
cunts
animals
40.92
asshole
negroe
方法比較
49
傳統 TFIDF
我們的方法
他山之石?
To BE or NOT to BE
50
辭典/斷詞系統乎?
51
▷要
• 領域用詞變化不大
• 只有某些詞才重要
• 文本的錯誤不多
• 保守
▷不要
• 領域用詞變化很快
• 字詞的關聯更重要
• 文本錯字連篇
• 冒險
某些演算法名過其實?
▷演算法的設計初衷是什麼?
• 如:TFIDF原本用來找出較能代表文章的字詞
▷演算法原始的設計假設是什麼?
▷目前的問題和資料有完全符合嗎?
• 是否需要修正?
• 如何根據問題本身修正?
52
TFIDF效果很差?
▷預期目的是什麼?
• 找出有效區別文件的字詞
→IDF: 文件差異性
• 找出有效區別情緒的字詞
→IEF: 情緒差異性
▷ 平衡與否?
• TF重要性  IDF重要性
53
怎麼考慮特徵點的關聯?
▷直接交給演算法
• Machine learning
• Association rules
• Regression
▷自己先找出關聯性
• 可以將資料轉成圖 (Graph)
→ 特徵為點、相關性為邊
→ 分析點的中心關係、係數關係
54
通常是找出特徵點
和結果的關聯
通常是找出特徵點
和特徵點的關聯
我的公司/老闆/專案想要導入AI
▷為什麼?
• 因為大家都在做
→Followers
→只能進入Cost-down的競爭中
• 因為很炫、很好用
→別人的經驗未必能複製
→能找到自己的特色嗎?
• 有補助
→請記得初衷
→No pain no gain
55
Niche?
More in the future…
Thank you.
Contact me at:
yishin@gmail.com

Contenu connexe

Similaire à 2017大數據情緒分析的經驗分享

大數據下的情緒分析
大數據下的情緒分析大數據下的情緒分析
大數據下的情緒分析Yi-Shin Chen
 
程式 x 設計 @ MOPCON 2014
程式 x 設計 @ MOPCON 2014程式 x 設計 @ MOPCON 2014
程式 x 設計 @ MOPCON 2014Chun-Yu Tseng
 
#感恩Ppt+说服力# carrie-0223
#感恩Ppt+说服力# carrie-0223#感恩Ppt+说服力# carrie-0223
#感恩Ppt+说服力# carrie-0223yuezixi
 
破解優質溝通力密碼
破解優質溝通力密碼破解優質溝通力密碼
破解優質溝通力密碼LIN JACK
 

Similaire à 2017大數據情緒分析的經驗分享 (7)

陳宜欣/大數據下的情緒分析
陳宜欣/大數據下的情緒分析陳宜欣/大數據下的情緒分析
陳宜欣/大數據下的情緒分析
 
大數據下的情緒分析
大數據下的情緒分析大數據下的情緒分析
大數據下的情緒分析
 
Presentations
PresentationsPresentations
Presentations
 
程式 x 設計 @ MOPCON 2014
程式 x 設計 @ MOPCON 2014程式 x 設計 @ MOPCON 2014
程式 x 設計 @ MOPCON 2014
 
#感恩Ppt+说服力# carrie-0223
#感恩Ppt+说服力# carrie-0223#感恩Ppt+说服力# carrie-0223
#感恩Ppt+说服力# carrie-0223
 
Presentations
PresentationsPresentations
Presentations
 
破解優質溝通力密碼
破解優質溝通力密碼破解優質溝通力密碼
破解優質溝通力密碼
 

Plus de Yi-Shin Chen

從自然語言處理到文字探勘
從自然語言處理到文字探勘從自然語言處理到文字探勘
從自然語言處理到文字探勘Yi-Shin Chen
 
從人工智慧反思教育現場
從人工智慧反思教育現場從人工智慧反思教育現場
從人工智慧反思教育現場Yi-Shin Chen
 
From NLP to text mining
From NLP to text mining From NLP to text mining
From NLP to text mining Yi-Shin Chen
 
照海華德福教育簡介
照海華德福教育簡介照海華德福教育簡介
照海華德福教育簡介Yi-Shin Chen
 
新竹實驗教育的新契機
新竹實驗教育的新契機新竹實驗教育的新契機
新竹實驗教育的新契機Yi-Shin Chen
 
一名女科技人的反思
一名女科技人的反思一名女科技人的反思
一名女科技人的反思Yi-Shin Chen
 
Examples of working with streaming data
Examples of working with streaming dataExamples of working with streaming data
Examples of working with streaming dataYi-Shin Chen
 
2017 ncu experience sharing
2017 ncu experience sharing2017 ncu experience sharing
2017 ncu experience sharingYi-Shin Chen
 
Quick Tour of Text Mining
Quick Tour of Text MiningQuick Tour of Text Mining
Quick Tour of Text MiningYi-Shin Chen
 
Quick tour all handout
Quick tour all handoutQuick tour all handout
Quick tour all handoutYi-Shin Chen
 
TAAI 2016 Keynote Talk: Contention and Disruption
TAAI 2016 Keynote Talk: Contention and DisruptionTAAI 2016 Keynote Talk: Contention and Disruption
TAAI 2016 Keynote Talk: Contention and DisruptionYi-Shin Chen
 
TAAI 2016 Keynote Talk: Intercultural Collaboration as a Multi‐Agent System
TAAI 2016 Keynote Talk: Intercultural Collaboration as a Multi‐Agent SystemTAAI 2016 Keynote Talk: Intercultural Collaboration as a Multi‐Agent System
TAAI 2016 Keynote Talk: Intercultural Collaboration as a Multi‐Agent SystemYi-Shin Chen
 
TAAI 2016 Keynote Talk: It is all about AI
TAAI 2016 Keynote Talk: It is all about AITAAI 2016 Keynote Talk: It is all about AI
TAAI 2016 Keynote Talk: It is all about AIYi-Shin Chen
 
2016 datascience emotion analysis - english version
2016 datascience emotion analysis - english version2016 datascience emotion analysis - english version
2016 datascience emotion analysis - english versionYi-Shin Chen
 
照海華德福教育簡介
照海華德福教育簡介照海華德福教育簡介
照海華德福教育簡介Yi-Shin Chen
 

Plus de Yi-Shin Chen (16)

從自然語言處理到文字探勘
從自然語言處理到文字探勘從自然語言處理到文字探勘
從自然語言處理到文字探勘
 
從人工智慧反思教育現場
從人工智慧反思教育現場從人工智慧反思教育現場
從人工智慧反思教育現場
 
From NLP to text mining
From NLP to text mining From NLP to text mining
From NLP to text mining
 
照海華德福教育簡介
照海華德福教育簡介照海華德福教育簡介
照海華德福教育簡介
 
新竹實驗教育的新契機
新竹實驗教育的新契機新竹實驗教育的新契機
新竹實驗教育的新契機
 
一名女科技人的反思
一名女科技人的反思一名女科技人的反思
一名女科技人的反思
 
Examples of working with streaming data
Examples of working with streaming dataExamples of working with streaming data
Examples of working with streaming data
 
2017 ncu experience sharing
2017 ncu experience sharing2017 ncu experience sharing
2017 ncu experience sharing
 
Quick Tour of Text Mining
Quick Tour of Text MiningQuick Tour of Text Mining
Quick Tour of Text Mining
 
Quick tour all handout
Quick tour all handoutQuick tour all handout
Quick tour all handout
 
TAAI 2016 Keynote Talk: Contention and Disruption
TAAI 2016 Keynote Talk: Contention and DisruptionTAAI 2016 Keynote Talk: Contention and Disruption
TAAI 2016 Keynote Talk: Contention and Disruption
 
TAAI 2016 Keynote Talk: Intercultural Collaboration as a Multi‐Agent System
TAAI 2016 Keynote Talk: Intercultural Collaboration as a Multi‐Agent SystemTAAI 2016 Keynote Talk: Intercultural Collaboration as a Multi‐Agent System
TAAI 2016 Keynote Talk: Intercultural Collaboration as a Multi‐Agent System
 
TAAI 2016 Keynote Talk: It is all about AI
TAAI 2016 Keynote Talk: It is all about AITAAI 2016 Keynote Talk: It is all about AI
TAAI 2016 Keynote Talk: It is all about AI
 
Research and life
Research and lifeResearch and life
Research and life
 
2016 datascience emotion analysis - english version
2016 datascience emotion analysis - english version2016 datascience emotion analysis - english version
2016 datascience emotion analysis - english version
 
照海華德福教育簡介
照海華德福教育簡介照海華德福教育簡介
照海華德福教育簡介
 

2017大數據情緒分析的經驗分享

Notes de l'éditeur

  1. Why do we replace SW and not CW: first, they are more stable and more frequent