introduction to document classification 2014

22
2014年の文書分類入門 徳永 拓之 2014/06/19 PFIセミナー

Upload: hiroyuki-tokunaga

Post on 14-Jun-2015

493 views

Category:

Engineering


5 download

DESCRIPTION

2014/06/19のPFIセミナーの発表資料です

TRANSCRIPT

Page 1: Introduction to document classification 2014

2014年の文書分類入門 徳永 拓之

2014/06/19 PFIセミナー

Page 2: Introduction to document classification 2014

自己紹介:徳永拓之 ●  主に自然言語処理をしています ●  http://tkng.org ●  twitter:@tkng ●  カレーが好き ●  1年で7kgぐらい痩せました

Page 3: Introduction to document classification 2014

本日のテーマ:文書分類 文書を2つ以上のクラスに分類する ●  スパム判定

o  スパムかそうでないかの二値分類 ●  評判分類

o  すごくいい/いい/普通/ダメ/論外 の五値分類とか なんだかんだ仕事で触れる機会が多い

Page 4: Introduction to document classification 2014

文書分類と私 http://d.hatena.ne.jp/tkng/20081217/1229475900

Page 5: Introduction to document classification 2014

問題定義 入力xに対し、出力y = 1 or -1を出力するような関数f(x)を学習する ●  特に、f(x) = [w ・x] の場合、f(x)を線形分類器と呼ぶ(ただし、[]は中身の符号に応じて1 or -1を返すものとする)

●  今日の話はだいたい線形分類の話

Page 6: Introduction to document classification 2014

bag of wordsの復習 xは、x_kはある単語kが文書に含まれていれば1、そうでなければ0となるようなベクトル 線形識別器では、wはxの各次元の重みを学習していることになる

Page 7: Introduction to document classification 2014

最近の研究いろいろ ●  NBSVM (ACL2012) ●  Volume Regularization (NIPS2012) ●  Sentence Regularization (ICML2014) ●  Paragraph Vector (ICML2014)

Page 8: Introduction to document classification 2014

生成モデルと識別モデル 生成モデル:Naive Bayesなど 識別モデル:ロジスティック回帰、SVMなど 識別モデルの方が性能は高いと言われている

Page 9: Introduction to document classification 2014

生成モデル(Naive Bayes)の概要

P(y|x) ∝ P(x|y)P(y)

P(y)もP(x|y)もカウントで簡単に計算できる

Page 10: Introduction to document classification 2014

識別モデル(SVM)の概要 min. L(w) = Σ max(1 - y w・x, 0) + ||w||^2 損失項と正則化項の和を最小化する ●  損失項 :学習データに対する間違いを少なく ●  正則化項:過度に複雑なモデルを防ぐ

Page 11: Introduction to document classification 2014

本当に識別モデルの方がいいのか? ●  誤分類の原因を調査すると、識別モデルの学習結果に納得できないことが結構ある o  あるクラスに20回、他のクラスに2回しか出てこない単語の重みが0.1ぐらいしかない

o  一方、あるクラスに1000回、他のクラスに2000回ぐらい出てる単語の重みが1.3ぐらいになったりする

Page 12: Introduction to document classification 2014

何が起きているのか? ●  正則化をかけると、出現頻度が低い単語の重みはどうしても低くなりがち

●  かといって正則化を弱めると、性能は悪くなることが多い

経験則としては、珍しい単語は重要な事が多いのだが、正則化により重みが消えてしまう

Page 13: Introduction to document classification 2014

tf idf tf idf: ある単語の重要度をはかる指標 tf: term frequency df: document frequency idf: inversed document frequency

Page 14: Introduction to document classification 2014

idfを考慮した文書分類 Tackling the Poor Assumptions of Naive Bayes Text Classifiers ( Rennie et al., ICML2003) ●  最初に紹介したComplement Naive Bayesの論文

Page 15: Introduction to document classification 2014

Complement Naive Bayesを振り返る Term Weighted CNBはSVMと同等の性能…

Page 16: Introduction to document classification 2014

※厳密には、idfではなく出現率の比を見ているのでモチベーションが違います

       ____      /⌒  ⌒ \    /( ●)  (●) \

  /::::::⌒(__人__)⌒::::: \   だったらSVMにidfを入れるお!   |     |r┬-|     |   \      `ー'´      /

Page 17: Introduction to document classification 2014

クラス比で入力単語の重みを事前にスケーリングしてからSVMにつっこむ え、そんな単純な手法でいいの…?

Naive Bayes SVM (Wang, ACL2012)

Page 18: Introduction to document classification 2014

実験結果 普通のSVMより2~3%性能が向上

Page 19: Introduction to document classification 2014

感想 ●  SVMに突っ込む前にちょっと前処理すると性能が上がる、おいしい

●  黒魔術不要なのでベースラインによい ●  何をやってるかわかりやすいのもポイント

Page 20: Introduction to document classification 2014

余談:数式の型が気持ち悪い

matlabだと実数とベクトルが足せるらしい

Page 21: Introduction to document classification 2014

今後の展望、期待

●  文書分類で現状のstate of the artはparagraph vectorだがこれは黒魔術感がある

●  文書分類の特徴(高次元、スパース、低頻度特徴にも明らかに重要なのがある)を活かした新しい手法はまだ開発の余地があるのでは

Page 22: Introduction to document classification 2014

最近の研究いろいろ(再掲) ●  NBSVM (ACL2012) ●  Volume Regularization (NIPS2012) ●  Sentence Regularization (ICML2014) ●  Paragraph Vector (ICML2014)