SlideShare a Scribd company logo
1 of 32
言語処理のための機械学習4. 分類 (4.1~4.2)
4章のもくじ 4.1:準備 4.2:ナイーブベイズ分類器 4.3:サポートベクトルマシン 4.4:カーネル法 4.5:対数線形モデル 4.6:素性選択 4.7:まとめ
4.1 準備 分類 ある事例をあらかじめ決めたグループに分けること 自然言語処理における具体例 電子メールの分類 品詞タグ付け 係り受け解析 メール 仕事 関係 プライベート スパムメール クラス・カテゴリ
分類器の構築 規則ベース手法 人間の知識や直感を規則化 分類規則に基づく分類 例)『「い」で終わる単語は形容詞である』   センタリング理論に基づいた照応解析 話題を追跡できれば、 照応/省略が解決できる 話題として意識されている概念は照応/省略の対象になりやすい
分類器の構築 データから自動的に分類器を構築 ナイーブベイズ分類器 (4.2) SVM (4.3) ラベル付きデータ集合が必要 データ集合: :事例 :ラベル :ラベルの集合
学習手法 教師付き学習 ラベル付きデータを用いて行う学習 分類問題 教師なし学習 ラベル無しデータを用いて行う学習 クラスタリング
4.2 ナイーブベイズ分類器 確率に基づく分類器 事例dに対して、P(c|d)が最大となるクラスc∈Cを出力 P(c|d)を求めるため、工夫を行う ベイズの定理 分母は クラスには依存しない の計算は容易でない
ナイーブベイズ分類器 本節では、文書分類を想定 文書dに対するクラスcを求める 文書dに簡単化したモデルを仮定し、P(d|c)の値を求める 多変数ベルヌーイモデル 多項モデル
多変数ベルヌーイモデル 単語の生起・不生起をモデル化 モデルの導入 語彙V:単語の集合 :ベルヌーイ分布に従う確率変数 単語w クラスc ・単語wがクラスcの事例内で出現する場合に1の値をとる :各ベルヌーイ分布を規定するパラメータ ・これらのベルヌーイ分布は互いに独立とする P(d|c)は多変数ベルヌーイ分布に従う (1.3.4)
多変数ベルヌーイモデル 文書dの生起確率 多変数ベルヌーイモデル ・クラスcが与えられているときに  各単語wが生起するかどうかを表す確率 :単語wが文書dに出現した場合、値が1になる
パラメータの最尤推定 対数尤度関数 データ集合: :クラスcの訓練文書数 :クラスcであり、かつ単語wを含む訓練文書数
パラメータの最尤推定 以下の制約付き最適化問題を解く ラグランジュ未定乗数法を用いる Max s.t :求めたいパラメータの集合
パラメータの最尤推定 (クラスcに属する訓練文書のうちwを含む文書の数) (クラスcに属する訓練文書数) (クラスcに属する訓練文書数) (訓練文書数) と合わせると
例題4.1 “good bad good good” “exciting exciting” P氏 “good goodexciting boring” “bad boringboringboring” “bad good bad” N氏 “bad badexciting boring” 統計値の一部 同じ文書における頻度情報は パラメータ計算に影響しない パラメータの一部
例題4.2 以下の文書を分類 “good goodbad boring” 上の文書はN氏に書かれたと予測している
例題4.3 文書1を変更 “fine”以外の単語に関するパラメータは変化しない 以下の文書を分類 “good bad good good fine” “bad badboring boringfine” ある単語がデータに出現しなかったため 上の文書はP氏に書かれたと予測している
MAP推定 パラメータの事後確率を最大にする値をパラメータの推定値とする手法 ベイズの定理より :ディリクレ分布 ディリクレ分布 最大化する目的関数
MAP推定 ラグランジュ未定乗数法により解く :クラス数 と合わせると αはデータの生起回数全体に 下駄をはかせていると解釈できる
例題4.4 例題4.3のデータからMAP推定によりナイーブベイズ分類器を構築 パラメータの一部 “good bad good good fine” “exciting exciting” P氏 “good goodexciting boring” “bad boringboringboring” “bad good bad” N氏 “bad badexciting boring”
例題4.4 最尤推定とMAP推定のパラメータの比較 MAP推定のほうがパラメータの値が極端ではなくなる (スムージング)
例題4.5 以下の文書を分類する “bad badboring boringfine” 上の文書はN氏に書かれたと予測している MAP推定と最尤推定では大抵の場合、 MAP推定のほうが分類性能が高い
多項モデル 文書中の各位置についてどんな単語が起こるかをモデル化 モデルの導入 語彙Vの中から1つの単語を選ぶ操作を|d|回繰り返すことで文書を生成 P(d|c)を多項分布でモデル化 :文書d内の単語数 :クラスcの時に、単語wが選ばれる確率 :|V|個の値(単語)を取りうる確率変数 :クラスを値とする確率変数
多項モデル ,[object Object]
文書の長さを決定しないとならないため、求める分布は
文書の長さがクラスに依存しない仮定を置かない場合、以下の確率を考える必要があるK:文書の長さを表す確率変数
多項モデル 多項モデル 最大化するクラスを出力
2つのモデルの比較 多変数ベルヌーイモデル 文書での単語の生起情報により文書を表現 単語が生起しない情報も考慮 多項モデル 文書での単語の生起回数により文書を表現 生起しない単語は無視
最尤推定 対数尤度関数
最尤推定 以下の制約付き最適化問題を解く ラグランジュ未定乗数法を用いる Max s.t と合わせると と合わせると
最尤推定 パラメータの比較 多項モデル 多変数ベルヌーイモデル (クラスcに属する訓練文書全体のうちwの出現回数) (クラスcに属する訓練文書全体の全単語の出現回数) (クラスcに属する訓練文書のうちwを含む文書の数) (クラスcに属する訓練文書数)
例題4.6 “good bad good good” “exciting exciting” P氏 “good goodexciting boring” “bad boringboringboring” “bad good bad” N氏 “bad badexciting boring” 統計値の一部 パラメータの一部 単語に関する和を取る
例題4.7 以下の文書を分類 “good goodbad boring” 上の文書はP氏に書かれたと予測している 一部のパラメータが0になるという 問題点は同様に存在

More Related Content

Featured

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 

Featured (20)

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 

Ml for nlp_chapter_4