狠狠撸

狠狠撸Share a Scribd company logo
ガンマ一般化
線形回帰モデル
デンソーアイティーラボラトリ
内海 慶 kuchiumi@d-itlab.co.jp
今日の話
? 独立な少数のサンプルから,サンプルの最大値を求めたい
? 極値分布とかをまじめに求める話
? 文字列の一部を見て,単語の最大長を推定する(今日の話)
? 紹介するのはサンプルの極値がガンマ分布に従うと仮定した手法
? ツールは公開されている
? gamglm(http://www.chasen.org/~daiti-m/dist/gamglm/)
単語の長さの分布
0
0.1
0.2
0.3
0.4
0.5
0.6
1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89
日本語
中国語
タイ語
どこかにピークがあって
指数的に減衰する
ガンマ分布
単語の長さはガンマ分布
? x:単語の長さ
? a,b: ガンマ分布のパラメータ
? こいつを回帰してやれば良い
? 実際には同一言語内でも,観測文字列毎に単語の長さは変化する
? 接尾辞が「株式会社」なら単語の最大文字列長は20とかになりそう
? 接尾辞が「が」や「を」,「に」なら単語の最大文字列長はだいたい1になる
ちなみに
? 日本で一番長い株式会社の名前は137文字
株式会社あなたの幸せが私の幸せ世の為人の為人
類幸福繋がり創造即ち我らの使命なり今まさに変
革の時ここに熱き魂と愛と情鉄の勇気と利他の精
神を持つ者が結集せり日々感謝喜び笑顔繋がりを
確かな一歩とし地球の永続を約束する公益の志溢
れる我らの足跡に歴史の花が咲くいざゆかん浪漫
輝く航海へ
接尾辞毎に
パラメータを変えたい
? f: 接尾辞の特徴ベクトル
? w,v: a,b を回帰するパラメータ
パラメータ推定
? 訓練データの対数尤度を最大化したい
? 勾配法で解くと局所解にハマる
? 特徴の間に相関がある(勾配自体にも相関がある)
? パラメータが殆ど0という結果になった
? ※いまいちこの辺分かってないので説明できません
? MCMCでパラメータを推定する
MCMC
? w, vを初期化
1. w, v どちらかの feature index を1つ選ぶ
? w[id] ← w[id] + η*u; //
? パラメータ変更前と変更後の尤度計算(Lik_1,Lik_2)
? if (bernoulli(Lik2 - Lik1) { return accept; }else {return revert; }
? 1に戻る
尤度計算の式
予測の方法
? ガンマ分布の累積分布関数の値が閾値を超える文字列長を
最大文字列長として出力する
? 累積分布関数はGSLに実装がある
? gsl_cdf.h にある gsl_cdf_gamma_P が使える
? a, b の値は観測された接尾辞から回帰する
? 予測プログラム
for (int i = 1; i < max_length; ++i){
if (gamma_cdf(i, a, 1./b) > p) return i;
}
実験
? 特徴量
特徴 概要
w_i 位置 t - i の文字 (0 <= i <= 1)
t_i 位置 t - i の文字種 (0 <= i <= 4)
type 位置 t の文字種が直前で何文字続くか
c 位置 t から最大8文字前までで文字種の変化した回数
使用データ
? 日本語,中国語,タイ語
? 日本語:BCCWJ PN 1万文(ニュース記事)
? 中国語:SIGHAN bakeoff 2005 MSR 1万文 (科学記事)
? タイ語:InterBEST 2009 novel 1万文
予測精度
(累積分布関数の閾値0.95)
単語の長さ 日本語 中国語 タイ語
1 1.000 1.000 1.000
2 1.000 0.999 1.000
3 1.000 0.962 0.972
4 0.460 0.590 0.950
5 0.018 0.281 0.940
6 0.000 0.300 0.817
7 0.000 0.000 0.593
8 0.000 0.000 0.195
9 0.000 0.000 0.0645
10 0.000 0.000 0.250
予測した最大長に正しい単語の長さが含まれる場合を正解とする
まとめ
? 大半が短い語なので,短い単語の長さはほぼ間違いなく求めら
れた
? 低頻度の長い単語になると誤りが多い
? タイ語は長い単語の頻度がそれなりにあるので,その分精度が
出ている
? 指数的に頻度が減衰するような極値を求めたい場合に使えそう
な手法なので,興味ある人は使ってみてください
? ちなみに公開されているツールには学習器はgammaのa,bを回帰
するので,単語長の予測とかは別途自分で書く必要がある

More Related Content

Viewers also liked (16)

ディープラーニングの车载応用に向けて
ディープラーニングの车载応用に向けてディープラーニングの车载応用に向けて
ディープラーニングの车载応用に向けて
Ikuro Sato
?
On the eigenstructure of dft matrices(in japanese only)
On the eigenstructure of dft matrices(in japanese only)On the eigenstructure of dft matrices(in japanese only)
On the eigenstructure of dft matrices(in japanese only)
Koichiro Suzuki
?
DSIRNLP06 Nested Pitman-Yor Language Model
DSIRNLP06 Nested Pitman-Yor Language ModelDSIRNLP06 Nested Pitman-Yor Language Model
DSIRNLP06 Nested Pitman-Yor Language Model
Kei Uchiumi
?
Holonomic Gradient Descent
Holonomic Gradient DescentHolonomic Gradient Descent
Holonomic Gradient Descent
Yoshiaki Sakakura
?
Swift 2 (& lldb) シンホ?シ?ウム
Swift 2 (& lldb) シンホ?シ?ウムSwift 2 (& lldb) シンホ?シ?ウム
Swift 2 (& lldb) シンホ?シ?ウム
Yuichi Yoshida
?
情报検索における评価指标の最新动向と新たな提案
情报検索における评価指标の最新动向と新たな提案情报検索における评価指标の最新动向と新たな提案
情报検索における评価指标の最新动向と新たな提案
Mitsuo Yamamoto
?
Halide, Darkroom - 並列化のためのソフトウェア?研究
Halide, Darkroom - 並列化のためのソフトウェア?研究Halide, Darkroom - 並列化のためのソフトウェア?研究
Halide, Darkroom - 並列化のためのソフトウェア?研究
Yuichi Yoshida
?
Paper intoduction "Playing Atari with deep reinforcement learning"
Paper intoduction   "Playing Atari with deep reinforcement learning"Paper intoduction   "Playing Atari with deep reinforcement learning"
Paper intoduction "Playing Atari with deep reinforcement learning"
Hiroshi Tsukahara
?
It Shouldn't Be Scary to Go Digital
It Shouldn't Be Scary to Go DigitalIt Shouldn't Be Scary to Go Digital
It Shouldn't Be Scary to Go Digital
Kyle Lacy
?
Basic of guitar
Basic of guitarBasic of guitar
Basic of guitar
javamofcb
?
Helping Haiti in the Wake of Hurricane Matthew
Helping Haiti in the Wake of Hurricane MatthewHelping Haiti in the Wake of Hurricane Matthew
Helping Haiti in the Wake of Hurricane Matthew
Carl Turnley
?
[insert period joke here] Researching Menstruation Online
[insert period joke here] Researching Menstruation Online[insert period joke here] Researching Menstruation Online
[insert period joke here] Researching Menstruation Online
Astrid Bigoni
?
Pp kegemaran saya- miera
Pp kegemaran saya- mieraPp kegemaran saya- miera
Pp kegemaran saya- miera
Imma MieYa
?
An Analysis of Different MOOC Environments from the Students’ Perspective , e...
An Analysis of Different MOOC Environments from the Students’ Perspective , e...An Analysis of Different MOOC Environments from the Students’ Perspective , e...
An Analysis of Different MOOC Environments from the Students’ Perspective , e...
Diana Andone
?
ディープラーニングの车载応用に向けて
ディープラーニングの车载応用に向けてディープラーニングの车载応用に向けて
ディープラーニングの车载応用に向けて
Ikuro Sato
?
On the eigenstructure of dft matrices(in japanese only)
On the eigenstructure of dft matrices(in japanese only)On the eigenstructure of dft matrices(in japanese only)
On the eigenstructure of dft matrices(in japanese only)
Koichiro Suzuki
?
DSIRNLP06 Nested Pitman-Yor Language Model
DSIRNLP06 Nested Pitman-Yor Language ModelDSIRNLP06 Nested Pitman-Yor Language Model
DSIRNLP06 Nested Pitman-Yor Language Model
Kei Uchiumi
?
Swift 2 (& lldb) シンホ?シ?ウム
Swift 2 (& lldb) シンホ?シ?ウムSwift 2 (& lldb) シンホ?シ?ウム
Swift 2 (& lldb) シンホ?シ?ウム
Yuichi Yoshida
?
情报検索における评価指标の最新动向と新たな提案
情报検索における评価指标の最新动向と新たな提案情报検索における评価指标の最新动向と新たな提案
情报検索における评価指标の最新动向と新たな提案
Mitsuo Yamamoto
?
Halide, Darkroom - 並列化のためのソフトウェア?研究
Halide, Darkroom - 並列化のためのソフトウェア?研究Halide, Darkroom - 並列化のためのソフトウェア?研究
Halide, Darkroom - 並列化のためのソフトウェア?研究
Yuichi Yoshida
?
Paper intoduction "Playing Atari with deep reinforcement learning"
Paper intoduction   "Playing Atari with deep reinforcement learning"Paper intoduction   "Playing Atari with deep reinforcement learning"
Paper intoduction "Playing Atari with deep reinforcement learning"
Hiroshi Tsukahara
?
It Shouldn't Be Scary to Go Digital
It Shouldn't Be Scary to Go DigitalIt Shouldn't Be Scary to Go Digital
It Shouldn't Be Scary to Go Digital
Kyle Lacy
?
Basic of guitar
Basic of guitarBasic of guitar
Basic of guitar
javamofcb
?
Helping Haiti in the Wake of Hurricane Matthew
Helping Haiti in the Wake of Hurricane MatthewHelping Haiti in the Wake of Hurricane Matthew
Helping Haiti in the Wake of Hurricane Matthew
Carl Turnley
?
[insert period joke here] Researching Menstruation Online
[insert period joke here] Researching Menstruation Online[insert period joke here] Researching Menstruation Online
[insert period joke here] Researching Menstruation Online
Astrid Bigoni
?
Pp kegemaran saya- miera
Pp kegemaran saya- mieraPp kegemaran saya- miera
Pp kegemaran saya- miera
Imma MieYa
?
An Analysis of Different MOOC Environments from the Students’ Perspective , e...
An Analysis of Different MOOC Environments from the Students’ Perspective , e...An Analysis of Different MOOC Environments from the Students’ Perspective , e...
An Analysis of Different MOOC Environments from the Students’ Perspective , e...
Diana Andone
?

Gamglm