SlideShare a Scribd company logo
1 of 34
Download to read offline
Weighted Finite-State Transducerについて
または
猫画像100選
DSIRNLP #4
phyllo
自己紹介
ID : phyllo
ブログ : http://d.hatena.ne.jp/jetbead
• 某Web企業の新卒
• 入社してから自然言語処理始めました
– 3年目突入
Weighted Finite-State Transducerについて
または
猫画像100選
DSIRNLP #4
phyllo
Weighted Finite-State Transducerについて
または
猫画像100選
DSIRNLP #4
phyllo
えー!?猫画像100選の方じゃないの!?
(期待されていた方ごめんなさい・・・)
本当は、レコメンドエンジン実装して
猫画像100枚選びたかった・・・
WFSTってなんだろう。
知らないとヤバいのかも・・・
猫画像集めてる
場合じゃねぇ!!
10分でわかる
Weighted Finite-State Transducerの基礎
もくじ
• WFSTとは
• 応用例
• WFSTの演算・操作
• 合成のアルゴリズム紹介
• ライブラリ、参考資料など
で、Weighted Finalなんとかって何?
Weighted Finite-State Transducer
• オートマトンの一種
– 様々な計算機構の数学モデルの総称
– 見やすさのため、「状態遷移図」がよく使われる
• 重み(コストや確率値)を導入した有限状態ト
ランスデューサー
有限状態アクセプタ
(FSA)
• 有限個の状態
• 有限個の入力記号
• 状態遷移関数
• 有限個の初期状態・受理状態
1
2
3
4
b
a b
a
a,b,c,…
入力abかbaのとき、受理するFSA
有限状態トランスデューサー
(FST)
• 有限個の状態
• 有限個の入力記号
• 状態遷移関数
• 有限個の初期状態・受理状態
• 有限個の出力記号
1
2
3
4
b:B
a:A b:B
a:A
a,b,c,…
A,B,C,…
入力abかbaのとき、大文字にしたものを出力するFST
重み付き有限状態トランスデューサー
(WFST)
• 有限個の状態
• 有限個の入力記号
• 状態遷移関数
• 有限個の初期状態・受理状態
• 有限個の出力記号
• 重み(入出力、遷移)
1
2
3
4/.5
b:B/.1
a:A/.2 b:B/.5
a:A/.3
a,b,c,…
A,B,C,…
.2,.5,…
入力abかbaのとき、大文字にしたものを出力しつつその確率も出力するFST
重み付き有限状態トランスデューサー
(WFST)
• 数学的な定義
– 有限個の状態 Q
– 有限個の入力記号セット Σ
– 重みを考慮した状態遷移関数 E
– 有限個の初期状態 I
– 有限個の受理状態 F
– 有限個の出力記号セット Δ
– 重みの半環 (R,⊕,⊗,0,1)
– 初期状態重み関数 λ
– 受理状態重み関数 ρ
半環: 加法的逆元がなくてもよい代数的構造
半環
• 以下の性質を満たす加法+、乗法・の2つの演算を備
えた集合R
– (R,+)が単位元0を持つ可換モノイドを成す
– (R,・)が単位元1を持つモノイドを成す
– 乗法は加法の上に分配的である
– 0倍はRをゼロ化する
• モノイドは、以下の2条件を満たす、集合Sと二項演算*
の組(S,*)
– 結合律:Sの元a,b,cについて、(a*b)*c=a*(b*c)
– 単位元の存在:Sの元eが存在し、Sの元aについて、
e*a=a*e=a
• 可換モノイドは、演算が可換であるようなモノイド
半環の例
• Boolean
– R:{0,1}
– 加法:∨
– 乗法:∧
– 単位元0:0
– 単位元1:1
• 確率
– R:[0,1]
– 加法:+
– 乗法:×
– 単位元0:0
– 単位元1:1
• log確率値
– R:[-∞,0]
– 加法:max
– 乗法:+
– 単位元0:-∞
– 単位元1:0
• tropical(ミニマムプラス代数)
– R:[-∞,+∞]
– 加法:min
– 乗法:+
– 単位元0:+∞
– 単位元1:0
• string
– R:Σ * ∪ {∞}
– 加法:longest common prefix
– 乗法:連結処理
– 単位元0:∞
– 単位元1:ε
表現が豊かになって
いろんなモデルが表現できる?
応用例
• 音声認識/音声合成
– 音響モデルや言語モデルをWFSTで表現
• 統計的機械翻訳
– 言語モデルや翻訳モデルをWFSTで表現
• 検索エンジンLucene
– 転置IndexをFSTで表現
• 画像処理/光学文字認識
• など
WFSTで表現して何がうれしいの?
多くの演算・操作が研究されている
• Composition
• Determinization
• Minimization
• Sum(Union)
• Product(Concatenation)
• Closure(Kleene-closure)
• Reversal
• Inversion
• Projection
• Intersection
• Difference
• Ambiguity
• Disambiguation
• Equivalence
• Weight Pushing
• Synchronization
• ε-removal
• Divergences
• Distances
• Input ε-Normalization
• Generic Single-Source
• All pairs Shortest Distance
• N Best Path
• N Best String
これらの操作ができる!
ちょ、多すぎ。
イケてるのはどれ?
WFST 1 WFST 2入力 出力WFST 3
WFST入力 出力
WFST
(状態数最小化)
入力 出力
WFST
(決定化)
入力 出力
Composition(合成)
Determinization(決定化)
Minimization(最小化)
(複数の処理を1つにまとめられる)
え、自分でモデルをいじらずに
処理全体を高速化・省メモリにできるの!
すげえええええ!!!
Composition(合成)
• 2つの直列のWFSTを1つに合成する
WFST 1 WFST 2
WFST 1&2
入力 出力
入力 出力
Composition algorithm
• ε遷移が無い場合
• 2つのWFSTの状態のペアを状態に持つWFST
を作る
QUEUEを使って、状態をたどり、
入出力の合う遷移を一つにして
合成後の遷移にする。
Composition algorithm
• ε遷移がある時は、うまくいかない例がある
– (WFSTで表現された)フィルタを間に入れる
• N個のWFSTを同時に合成する方法も提案されている
ほう、面白い。
自分でも実装してみたい
資料
• Mohri, “Weighted Automata Algorithms”
– http://www.cs.nyu.edu/~mohri/pub/hwa.pdf
– 各種説明やアルゴリズムの紹介がされてる
– 図などもこちらから使わせていただいています
ライブラリとか
• OpenFst Library
http://www.openfst.org/twiki/bin/view/FST/WebHome
• AT&T FSM Library
http://www2.research.att.com/~fsmtools/fsm/
• Java FST Framework
http://jsalatas.ictpro.gr/java-fst-framework-api-review/
• SFST
http://www.cis.uni-muenchen.de/~schmid/tools/SFST/
その他
• Mohriさんのまとめ
– http://www.cs.nyu.edu/~mohri/transducer-
algorithms.html
• Tsukadaさんのまとめ
– http://sig-slp.jp/slide44/tsukada.pdf
• International Conference on Implementation
and Application of Automata
– http://cs.smu.ca/~ciaa2013/
• その他、検索してでてくるたくさんの資料
まとめ
• WFSTは、オートマトンの一種
– 入力に対し、重みを考慮しつつ出力
– いろんなモデルを表現できる
– WFSTに対して演算や操作が統一的に行える
• いろんな演算がある
– 特に、合成、最小化などを行うことで、省メモリで
実行できるようにモデルを変換できる
ご静聴ありがとうございました

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
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
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
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...
 

Weighted Finite-state Transducerについて