29
Hashing with Graphs [Liu+ 2011] @nokuno ICML読み会

Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

Embed Size (px)

DESCRIPTION

ICML2011読み会の発表資料です.

Citation preview

Page 1: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

Hashing  with  Graphs  [Liu+  2011]

@nokuno  ICML読み会

Page 2: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

大まかな流れ

•  背景と目的  •  問題設定  •  Anchor  Graphの導入  •  out-­‐of-­‐sample拡張  •  実験と考察

Page 3: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

近傍探索とは?

•  あるデータが与えられたとき、データベースからk個の類似データを検索したい(k近傍探索)  

•  応用例:類似画像検索(著者のLiuも画像畑),重複文書検知など  

•  高次元・大規模なデータは線形探索も木構造インデクシングも困難  

Page 4: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

Hashingによるアプローチ

•  似たデータが似たハッシュになりやすいハッシュ関数を用いる  

•  LSH:データを2値ベクトルに写像する  •  しかし、速度を優先すると精度が急激に悪化する

Page 5: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

LSHについて補足

•  距離尺度と対応するハッシュ関数

手法 対象 距離・類似度   hash関数 Bit  Sampling ビット列 Hamming距離 v_i MinHash 集合 Jaccard係数

min_i  h(v_i)

Random  ProjecNon

ベクトル Cosine距離 sign(v・r)

Page 6: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

データに基づくアプローチ

•  LSHはデータに依存しないハッシュ関数を使う  •  データに応じて最適なハッシュ関数を使えば性能が向上するのでは?  

•  高次元空間中の非線形な多様体は低次元で表現できるため,その上でハッシュを考える

Page 7: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

例:スイスロール

Page 8: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

既存手法[Weiss+  2009]の問題点

•  とにかく遅い  •  構築時:O(dn^2)  – 全ペアの類似度を計算する必要性  

•  検索時:O(rn)  – 固有ベクトルを未知データに拡張する計算時間が線形時間  

Page 9: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

問題設定

s.t.  

類似度行列 をデータi,  j間の類似度とする.

次のようなn×r行列Yを求める (Yは連続値を取る=spectral  relaxaNon)

2)  正負に偏りがない  

3)  列同士は直交

1)  A_ijが大きいところでY_iとY_jが近い              (Aの情報をできるだけ保存する)

使うときには  sign(Y)  で二値化する

Page 10: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

グラフラプラシアンによる解法

•  先の問題は以下のグラフラプラシアンの固有値分解によって解けることが知られている

解YはLの非ゼロの固有値の小さい順からr個を取った固有ベクトル

しかし,グラフラプラシアンの構築にはO(dn^2)の時間がかかり,  大規模データに適用するのは困難

Page 11: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

Anchor  Graphの導入

•  k-­‐meansで求めたm個の点u_jを中継して類似度を測る(Z:n×m行列)  

•  さらにスパースにするため,K(x_i,  u_j)はx_iに最も近いs個以外は0とおく  

•  論文ではKはガウス関数  

Page 12: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

図解:Anchor  Graph[Liu+  2010]

k-­‐meansでanchor  pointを求める  →  Anchor  Graph(2部グラフ)を作る

Page 13: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

人工データの例[Liu+  2010]

Page 14: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

Anchor  Graphの性質

•  類似度行列Aを以下の式で近似する  

•  1)  近似行列は非負かつスパース  •  2)  近似行列は低ランク(最大ランクm)  – 行列全体を保持する必要がない  

•  3)  近似行列は二重確率行列  – 行方向と列方向に正規化されている  

ただし

Page 15: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

低ランク性を用いた解法

•  n×m行列ZΛ^{-­‐1/2)の特異値分解を考える

∑を0要素でn×nに拡張した行列

であるから,(U,∑)は^hat{A}の固有値分解になっていることが分かる.

n×n m×m n×m n×m

この特異値分解は効率的に解ける

Page 16: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

Yの求め方

•  欲しいのはLの固有値のうち0を除いて小さい順にr個.  

•  であるから,Aの固有値から1を除いて大きい順にr個取ればよい.

Page 17: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

out-­‐of-­‐sample拡張

•  新しく来たデータxに対しハッシュを計算したい.  

•  とおいて,以下をハッシュ関数とする

Page 18: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

計算量

•  時間計算量  – 訓練時:O(dmnT+dmn+m^2n+(s+1)rn)  – テスト時:O(dm+sr)  

•  空間計算量  – 訓練時:O((d+s+r)n)  – テスト時:O(rn)  

•  nに対して,  – 訓練時は線形時間  – テスト時は定数時間

Page 19: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

実験設定

•  データ  – MNIST(手書き文字画像,  784次元,  70k)  

•  評価指標  – ランキングのMAP(Mean  Average  Precision)  

•   比較対象  – LSH,  Spectral  Hashingなど  

Page 20: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

実験結果

提案手法の精度が高い

Page 21: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

結論

•  大規模データに適用可能なグラフベースの教師なしハッシングを提案した  

•  高次元で非線形な多様体中の近傍構造を捉えられる  

•  実験により既存手法からの大幅な性能向上が認められた

Page 22: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

Page 23: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

Large  Scale  Text  ClassificaNon  using  Semi-­‐supervised  MulNnomial  Naive  Bayes  

[Su+  2011]

@nokuno  ICML読み会

Page 24: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

概要

•  NaiveBayesの半教師あり学習を提案  •  EMアルゴリズムと比較して高速・高精度  •  ラベルつきデータとラベルなしデータを別々に訓練可能

Page 25: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

NaiveBayesとは

•  単語生起の独立性を仮定した生成モデル

ラベル付きデータはなかなか手に入りにくい  →ラベルなしデータを使って精度を向上させたい

Page 26: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

EMアルゴリズム+NaiveBayes

•  ラベルなしデータのラベルを確率つきで現在のモデルから推定

これを使って更新を繰り返す(初期値は教師ありで学習)  誤ったラベルが残りやすい

Page 27: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

提案手法

•  ベイズの定理を2回適用してラベル付きとラベルなしコンポーネントに分解

ラベル付き ラベルなし

P(w)の推定にはGoogle  N-­‐gramなどが利用可能

Page 28: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

実験結果

•  精度比較

Page 29: Hashing with Graphs & Large Scale Text Classification using Semi-supervised Multinomial Naive Bayes #icmlreading

今度こそ終