Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ゼロつく2 輪読会 3.4-3.6
Search
keitaro2002
April 06, 2024
Programming
0
38
ゼロつく2 輪読会 3.4-3.6
keitaro2002
April 06, 2024
Tweet
Share
More Decks by keitaro2002
See All by keitaro2002
ゼロつく2 輪読会 3.1-3.3
keitaro2002
0
24
Other Decks in Programming
See All in Programming
SpringBootにおけるオブザーバビリティのなにか
irof
1
890
人には人それぞれのサービス層がある
shimabox
3
460
バリデーションライブラリ徹底比較
nayuta999999
1
430
RubyKaigi Hack Space in Tokyo & 函館最速 "予習" 会 / RubyKaigi Hack Space in Tokyo & The Fastest Briefing of RubyKaigi 2026 in Hakodate
moznion
1
120
衛星の軌道をWeb地図上に表示する
sankichi92
0
250
『Python → TypeScript』オンボーディング奮闘記
takumi_tatsuno
1
140
メモリリークが発生した時にpprofを使用して原因特定した話
zono33lhd
0
100
ユーザーにサブドメインの ECサイトを提供したい (あるいは) 2026年函館で一番熱くなるかもしれない言語の話
uvb_76
0
180
「兵法」から見る質とスピード
ickx
0
200
TypeScript LSP の今までとこれから
quramy
0
110
Rethinking Data Access: The New httpResource in Angular
manfredsteyer
PRO
0
220
イベントソーシングとAIの親和性ー物語とLLMに理解できるデータ
tomohisa
1
160
Featured
See All Featured
For a Future-Friendly Web
brad_frost
178
9.7k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2.1k
Scaling GitHub
holman
459
140k
Product Roadmaps are Hard
iamctodd
PRO
53
11k
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
Stop Working from a Prison Cell
hatefulcrawdad
269
20k
Raft: Consensus for Rubyists
vanstee
137
7k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
750
Documentation Writing (for coders)
carmenintech
71
4.8k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.8k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.8k
Transcript
ゼロつく2 輪読会 Part4 3.4~3.6 2024年 3⽉10⽇
‣ これ以降の図は以下より引⽤ 斎藤 康毅 「ゼロから作るDeep Learning ❷―⾃然⾔語処理編」 はじめに
‣ 前回の復習 ‣ CBOWモデルの実装 ‣ word2vecに関する補⾜ ⽬次
前回の復習
‣ カウントベース→推論ベース ‣ ミニバッチ学習 ‣ 周囲のコンテキストから出現確率を推測 ‣ one-hotベクトル処理 ‣ CBOW(Continuous
Bag-Of-Word) ‣ ⼊⼒層 = (B,N,L) (B: バッチサイズ,N: コンテキスト 数,L: コーパスの⻑さ) 前回の復習
CBOWの実装
学習 モデルアーキテクチャ 逆伝播の様⼦ optimizer : Adam
学習 loss推移 分散表現 コサイン類似度
word2vecの補⾜
‣ CBOWモデルを数式で考えてみる. ‣ 損失関数 ‣ 教師ラベル𝑡! は𝑤" に対応する箇所が1でその他は0 →𝑃(𝑤" |𝑤"#$
, 𝑤"%$ )のみが残る. ‣ コーパス全体 CBOWモデルと確率
‣ ターゲットからコンテキストを推測する. ‣ 損失関数 skip-gramモデル
‣ 推論ベース ‣ 語彙に新しい単語→学習済み重みを初期値として,パラ メータの再学習が可能 ‣ より複雑な単語間のパターンも捉えられる. ‣ 実際は単語の類似性に関する定量評価では優劣が つけられない
カウントベースvs推論ベース
Appendix
ソースコード 概要 ch3 simple_cbow.py train.py common layers.py optimizer.py trainer.py util.py
functions.py
‣ softmax ‣ cross_entropy_error functions.py
‣ MatMul ‣ init ‣params, grads ‣x (backwardで使⽤) ‣ forward
‣paramsとxを⾏列計算 ‣xを保持 ‣ backward ‣dx,dWを計算 ‣ SoftmaxWithLoss ‣ init ‣params, grads ‣y (softmaxの出⼒) ‣t (教師ラベル) ‣ forward ‣softmax ‣cross_entropy_error ‣ backward ‣dx layers.py
‣ Adam ‣ init ‣lr (学習率) optimizer.py
‣ init ‣ fit ‣ plot trainer.py
util.py