SlideShare une entreprise Scribd logo
1  sur  32
Deep Learning
Chap. 6 Deep Feedforward
Networks (pp.164-223)
Shion Honda
Journal Club @ DSP
概要
• Deep feedforward networks導入
• 例: XORの学習
• 勾配ベースの学習法
• 隠れユニット
• アーキテクチャ
• 誤差逆伝搬
• 歴史
2019/4/16 Shion HONDA 2
Deep feedforward networks
• 別名: feedforward neural networks, 多層パー
セプトロン(MLP)
• feedback結合があるものはRNN(→10章)
• の誤差を最小化する を学習
• 各層はニューロンを模した層からなる
• 脳を忠実に再現したモデルというよりは, 一般的な
関数を近似できるネットワークがたまたま脳に着想
を得ていたというイメージ
2019/4/16 Shion HONDA 3
線形モデルの拡張
• お馴染みの線形モデルを, ではなく に適
用して非線形な関係も学習可能にすることを考
える
• はデータ の「特徴」や「表現」を取り出す
1. 次元が大きい(表現力の高い)関数 を利用する
→過学習の原因
2. 人手で設計した関数 を利用する
→手間がかかる, ドメイン適応できない
3. ディープラーニング: 隠れ層の出力 の線形結合
• これを入れ子状にして表現力を高める
• 大量のデータで学習させる
2019/4/16 Shion HONDA 4
6.1 例: XORの学習
2019/4/16 Shion HONDA 5
導入
• XOR関数を例にとって, MLPが非線形な関係を
学べるか調べる
• XOR:
• は4点で, 最小二乗誤差(MSE)を最小化する
• 線形モデルでは誤差を0に
できない
• x2が0のときと1のときでx2
の傾きが異なる
2019/4/16 Shion HONDA 6
MLP
• 簡単な3層のMLPを利用する
• 素朴な方法
• このままだと で線形だからダメ
→非線形な関数が必要
• 多くのニューラルネットでは固定された非線形な関
数(活性化関数)としてReLU (rectified linear unit)
を採用している
2019/4/16 Shion HONDA 7
解
2019/4/16 Shion HONDA 8
solution
実際に計算してみよう!
input output
[注意]
• 他にも最適解が存在する
• 実際の問題ではパラメータ数がもっと多いので勾配降下法で解を探す
• 必ずしも大域的最適解は得られない
6.2 勾配ベースの学習
2019/4/16 Shion HONDA 9
ニューラルネットの非凸性
• ニューラルネットを使うと損失関数は非凸にな
り最適化が難しい
• 初期値依存性
• 局所最適解
→繰り返しパラメータを更新して損失を小さく
してく確率的勾配降下法(→5.9)
• 誤差逆伝搬: 無数にあるパラーメータを出力層
に近いところから順番に更新していく効率的な
アルゴリズム(→6.5)
2019/4/16 Shion HONDA 10
損失関数
• 最尤推定を使う場合, 負の対数尤度(NLL)を最
小化するのと同値
• これはpが正規分布で平均値を予測したい場合,
最小二乗誤差の最小化とも同値になる
• pの出力層に指数関数を繋げることが多い
→指数の肩が極端な負の数だと勾配が小さくなりや
すく学習が難しい
→対数変換はこの問題を緩和する(NLL推奨)
• ニューラルネットの高い表現力から, これは関数の
最適化問題(変分法)と考えることもできる(→19.4)
2019/4/16 Shion HONDA 11
データの経験分布とモデルの分布
の間の交差エントロピー
出力ユニット
• 線形ユニット
• 正規分布の平均の予測に使われる
• 飽和しないので勾配ベースの最適化が楽
• シグモイドユニット
• ベルヌーイ分布の予測に使われる(2クラス分類)
• 値域が[0,1]で確率分布の制約を満たす
• zをロジットと呼ぶ
• シグモイドは端の方で勾配が
緩やかになるので, NLLを
使うべし(MSEはダメ)
2019/4/16 Shion HONDA 12
出力ユニット
• ソフトマックスユニット
• 他項分布で使われる(他クラス分類)
• 対数尤度は
• zが極端な第2項が極端な負の値になると, 第2項は
小さくなるが, 第1項で勾配を伝えられる
• ラフに考えると第2項はmaxを微分可能にしたもの
→自信の大きな間違いに重い罰則を与える
→正解ラベルの値が大きければ第1項と第2項は
キャンセルして損失がほぼ0になる
• softmaxというよりはsoft”arg”max
2019/4/16 Shion HONDA 13
他の出力ユニット
• 正規分布の分散を予測したいとき
• 複数の値の回帰
• 混合密度ネットワーク(ガウス混合分布)
• 音や物体の動きの生成で有効
2019/4/16 Shion HONDA 14
3つの値を回帰する例
6.3 隠れユニット
2019/4/16 Shion HONDA 15
隠れユニット
• 隠れユニットの選択法について理論付けはなさ
れていない
• 「とりあえずReLU」でOK
• 隠れユニットの微分可能性
• ReLUはx=0で微分できない
• 「一部を除いたすべての領域で」微分できればよい
2019/4/16 Shion HONDA 16
ランプ関数とも呼ぶ
いろいろな活性化関数
• 2階微分が0, 1階微分は1か0とシンプル
• 負のときも勾配を伝えられるようにした
LReLU, PReLU, ELUなどもある
• sigmoid/tanhは勾配が0になりやすいので, 出
力層としてのみ使われる
2019/4/16 Shion HONDA 17
その他の活性化関数
• maxout
• 凸性を保持したまま表現
力を高めた
• softplus
• 経験的にはReLUの方が
良い
2019/4/16 Shion HONDA 18
Wikipediaには20種以上
6.4 アーキテクチャ
2019/4/16 Shion HONDA 19
万能近似性と深さ
• 層: ユニットの集合
• 万能近似定理 [Hornik+, 1989]
• ネットワークが十分な数の隠れユニットを持ってい
る場合, 任意のボレル可測関数を任意の制度で近似
できる
* の有界閉集合上の任意の連続関数はボレル可測
• 「近似可能」でも「学習可能」とは限らない
• 最適化アルゴリズムが最適なパラメータに辿り着けない
• 過適合
• ネットワークは「広く浅く」より「狭く深く」
した方が, 表現力を保ったままパラメータを減
らせる
2019/4/16 Shion HONDA 20
活性化関数をかけるイメージ
• Absolute value ReLUを繰り返し適用すると
…?
• 鏡像となる点どうしは同じ点に移される
• 2回の折り畳み(活性化関数)で4つの領域をまとめら
れる
• 入力次元d, ユニット数n, 深さlの場合の表現力
2019/4/16 Shion HONDA 21
nCd [Montufar+, 2014]
深さと性能の関係
• 左図
• 深いほうが良い
• 右図
• 浅いままパラメータ数を増やしてもダメ
• 11層だとパラメータ数の増加の効果が見える
• ちなみに, 畳込みは全結合に比べて劇的にパラメー
タを削減できる
• 関数は複数の単純な関数の組み合わせで表せる
2019/4/16 Shion HONDA 22
6.5 誤差逆伝搬
2019/4/16 Shion HONDA 23
誤差逆伝搬
• 損失関数の勾配を, 出力層に近い方から順番に
連鎖律で求めてパラメータ更新に使う
• 計算グラフを使う
• 各ノードで1つの演算を行う
• TensorFlowやChainerなどのフレームワークの内部
では, 順伝搬でこのようなグラフが構築される
• 『ゼロから作るDeep Learning』を読みましょう!
2019/4/16 Shion HONDA 24
計算グラフと連鎖律
• 前の層に勾配をバトンパスしていく
• 各層(クラス)のメソッドとしてbackward関数
を定義しておく
2019/4/16 Shion HONDA 25
予め実装しておく
順伝搬
• 入れ子状の合成関数として計算している
• 出力(予測結果)と教師ラベルで誤差を計算
2019/4/16 Shion HONDA 26
親ノードの計算結果を代入
1層の計算
逆伝搬
2019/4/16 Shion HONDA 27
微分の結果を保存するテーブル
参考書
• ゼロから作るDeep Learning
• 斎藤康毅, O’Reilly Japan, 2016.
• TensorFlowやChainerを使わずにNumPyだけで
DNNやCNNを実装
• Pythonや線形代数の導入から書いてあるので事前
知識不要!
• 自然言語処理を扱う第2弾もある
2019/4/16 Shion HONDA 28
6.6 歴史
2019/4/16 Shion HONDA 29
歴史ノート
• 連鎖律 [Leibniz, 1676] [L’Hopital, 1696]
• 勾配降下法 [Cauchy, 1847]
• 誤差逆伝搬 [LeCun, 1985] [Rumelhart+,
1986]など
• ここまでで理論的には概ね完成. その後の発展
は次による
• オープンな大規模データベースの登場
• GPUなど計算機性能の向上
2019/4/16 Shion HONDA 30
Geoffrey Hinton Yann LeCun Yoshua Bengio
まとめ
• 基本的には, モデル分布と経験分布の間で負の
対数尤度(交差エントロピーとも)を最小化する
• 活性化関数はReLUが良い
• ネットワークを深くすると表現力が高まる
• 誤差逆伝搬で大量のパラメータを効率的に更新
• 連鎖律
• 計算グラフ
2019/4/16 Shion HONDA 31
参考文献
2019/4/16 Shion HONDA 32
[1] I. Goodfellow et al., Deep Learning, MIT Press, 2016.
[2] 岩澤 他訳, 深層学習, ASCII DWANGO, 2018.

Contenu connexe

En vedette

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
 

En vedette (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...
 

Deep Learning Chap. 6: Deep Feedforward Networks

Notes de l'éditeur

  1. 尤度最大化  対数尤度最大化  NLL(誤差)最小化