Download - 論文紹介(Weight Uncertainty in Neural Networks)
![Page 1: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/1.jpg)
論文紹介C. Blundell, J. Cornebise,
K. Kavukcuoglu, and D. Wierstra, “Weight Uncertainty in Neural Networks,”
In Proceedings of the 32nd International Conference on Machine Learning
(ICML 2015), May 2015.
斉藤 翔汰2016 年 11 月 14 日
![Page 2: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/2.jpg)
05/02/2023 2
• ニューラルネットワークの重みを確率変数として捉え,その確率分布を学習するアルゴリズムを提案• このアルゴリズムを Bayes by Backprop と
呼ぶ
• 周辺尤度を最小化することによって,重みを正則化
• MNIST による実験では, Dropout に匹敵する正則化性能を持つ
• さらに強化学習のタスクにも使用
概要
![Page 3: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/3.jpg)
05/02/2023 3
• 順伝搬型の NN は過学習を起こしやすい• トレーニングデータの不確実性を正しく
評価できないことが原因
• ネットワークの重みに不確実性を導入• 変分ベイズ学習
を用いてネットワークを学習
1.Introduction
![Page 4: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/4.jpg)
05/02/2023 4
• 各重みの摂動の大きさも学習される• Bayes by Backprop は単一の
ネットワークを学習するかわりに,アンサンブルを学習する
• 他のアンサンブル手法と比較して,パラメータ数の増加量が 2 倍で済む
• 不偏性を持つモンテカルロ推定によって勾配を推定• 推定した勾配でアンサンブルを学習
1.Introduction
![Page 5: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/5.jpg)
05/02/2023 5
• : NN の確率モデル• :入力データ
• :正解ラベル
• :ネットワークの重み
• 分類問題であれば, はカテゴリの集合• はカテゴリの確率分布
• 回帰問題であれば,• は正規分布 ( 二乗損失に対応 )
2.Point Estimates of Neural Networks
![Page 6: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/6.jpg)
05/02/2023 6
• 重み は最尤推定 (MLE) で学習できる
• トレーニングセット に対し,最尤推定によって得た重み は次式
• は勾配降下法で得ることができる• 誤差逆伝搬が使用可能
2.Point Estimates of Neural Networks
によって分布は異なる
![Page 7: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/7.jpg)
05/02/2023 7
• 正則化は事前分布 を置き,事後確率が最大となる重み を求めればよい
• 事前分布によって,正則化の種類が変化• 正規分布なら L2 正則化 (or Weight Decay)• ラプラス分布なら L1 正則化
2.Point Estimates of Neural Networks
![Page 8: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/8.jpg)
05/02/2023 8
• テストデータ に対する未知のラベルの予測は次式
• 重みの事後分布 のもとで期待値を取ることは,無限の数の NNのアンサンブルを考えることと等しい
• そこで変分近似を学習に使用• 変分ベイズ学習
3.Being Bayesian by Backpropagation
![Page 9: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/9.jpg)
05/02/2023 9
• 変分 ( ベイズ ) 学習とは,真の事後分布 と KL-Divergence が最小となる分布 のパラメータ を求めること
3.Being Bayesian by Backpropagation
![Page 10: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/10.jpg)
05/02/2023 10
• 変形して得た次式は,自由エネルギーあるいは期待下限として知られている
• この関数 を複雑度コストと呼ぶ• データ の複雑さと事前確率 の
単純さのトレードオフを表している
• の最小値を解析的に求めることはできないので,勾配近似が必要
3.Being Bayesian by Backpropagation
![Page 11: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/11.jpg)
05/02/2023 11
3.1 Unbiased Monte Carlo gradients
を確率密度関数 に従う確率変数とし, を決定論的な関数とする. とおき, の周辺密度関数 が を満たすと仮定すれば, の に対する導関数について次が成立 :
Proposition 1.
![Page 12: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/12.jpg)
05/02/2023 12
• はパラメータのないノイズ のサンプルと変分事後分布のパラメータ を変換する関数• 変換には変分事後分布のサンプルを使用
• 以後,正規分布を用いた場合を考える
3.1 Unbiased Monte Carlo gradients
![Page 13: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/13.jpg)
05/02/2023 13
• 複雑度コストの最適化に Proposition1 を適用
• 関数 を次式とする
• このようにおけば, Proposition1 の左辺の期待値が複雑度コスト と一致
• 期待値計算のためにモンテカルロ法を用いる• 変分ベイズ推論のための誤差逆伝搬
アルゴリズムを得る (LeCun 1985 など )
3.1 Unbiased Monte Carlo gradients
![Page 14: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/14.jpg)
05/02/2023 14
3.1 Unbiased Monte Carlo gradients
• モンテカルロ推定によって,近似された複雑度コスト は次式
• 近似したコストの各項は変分事後分布から導かれる重みに依存している
• Common Random Numbers と呼ばれる分散減少手法の 1 つ
![Page 15: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/15.jpg)
05/02/2023 15
• 変分事後分布が対角成分のみの正規分布と仮定
• 標準偏差を とすることで,標準偏差は常に非負• 変分事後分布のパラメータは
• 重み は次式でサンプリングされる
3.2 Gaussian variational posterior
![Page 16: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/16.jpg)
05/02/2023 16
3.2 Gaussian variational posterior
Proposition1より導出
![Page 17: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/17.jpg)
05/02/2023 17
• Section3.2 の更新ルールによって,重みの事前分布・事後分布は直接更新させることはなくなった
• 事前分布 の決定に, scale mixture を導入
• 事前分布のハイパーパラメータはクロスバリデーションで決めたほうが良い• 学習中に更新すると経験分布にハマり
真のデータ分布を学習できない場合がある
3.3 Scale mixture prior
![Page 18: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/18.jpg)
05/02/2023 18
• 2 つの正規分布を Scale mixture する
• はネットワークの j 番目の重み
• 学習データに合わせた事前分布の設定をする必要がなくなった•今までは経験分布にハマらないように設定
する必要があった
3.3 Scale mixture prior
![Page 19: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/19.jpg)
05/02/2023 19
• 複雑度コスト はミニバッチでの最適化に適している
• Graves(2011) はミニバッチごとのコストを最小化する方法を提案している
• はサブセットの個数
•
3.4 Minibatches and KL re-weighting
![Page 20: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/20.jpg)
05/02/2023 20
• 重み付けの方法は他にもある
• ,例えば
• • 最初のうちは重みが更新されづらい
3.4 Minibatches and KL re-weighting
![Page 21: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/21.jpg)
05/02/2023 21
• Contextual Bandits とは永続的な状態を持たないシンプルな強化学習の問題
• 各ステップにおいて,エージェントに次が与えられる• コンテキスト
• 個の中から選択された行動
• 異なる行動によって報酬 が与えられる
• エージェントは報酬を最大化するように行動を選択
4. Contextual Bandits
![Page 22: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/22.jpg)
05/02/2023 22
• コンテキストは,以前のアクション,報酬,コンテキストとは独立して提示
• : エージェントが構築する報酬の確率分布• これを用いて,次のアクションを選択
•選択しなかった行動に対する報酬は不明
• オンラインでモデルを訓練
•探索をしない限り,準最適に行動
4. Contextual Bandits
![Page 23: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/23.jpg)
05/02/2023 23
• は NN でモデル化可能
• Thompson Sampling•活用 ( ベストな行動をとること ) と探索 ( 最適ではない行動をとること ) のどちらの行動を取るか選ぶ方法
• 1. モデルパラメータをセット→2. 期待される報酬が高い行動を選択→3. モデルパラメータをアップデート→ 1へ
• モデルパラメータのベイズ的処理が必要
4.1Thompson Sampling for Neural Networks
![Page 24: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/24.jpg)
05/02/2023 24
• Sec.3 に基づいた Thompson Sampling
4.1Thompson Sampling for Neural Networks
![Page 25: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/25.jpg)
05/02/2023 25
• はじめのうちは,変分事後確率は前の状態に近い•行動は一様に選ばれる
• エージェントが行動していくうちに変分事後確率が収束しはじめる•報酬が高かった行動に絞られていく
•行動選択がより決定論的に変化
4.1Thompson Sampling for Neural Networks
![Page 26: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/26.jpg)
05/02/2023 26
• 変分法は不確実性を過小評価しがちなことが知られている•探索が不十分で早期収束につながる恐れ
• しかし,今回の実験では早期収束は,見られなかった
4.1Thompson Sampling for Neural Networks
![Page 27: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/27.jpg)
05/02/2023 27
• 実験で行ったタスクは 3 つ• MNIST 分類
• 非線形回帰
• Contextual Bandits
5. Experiments
![Page 28: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/28.jpg)
05/02/2023 28
•共通設定• 前処理 : ピクセル値を 126 で割っておく
•隠れ層 : 2層•活性化関数 : ReLU• batchsize : 128• 学習率 : 10-3 , 10-4 , 10-5 から選択
5.1 Classification on MNIST
![Page 29: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/29.jpg)
05/02/2023 29
• Bayes by Backprop の設定• サンプル数 : 1, 2, 5, 10 から選択
• Scale Mixture の重み π : ¼ , ½ , ¾ から選択
• Scale Mixture で用いる分布の分散 :
5.1 Classification on MNIST
![Page 30: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/30.jpg)
05/02/2023 30
5.1 Classification on MNIST
•★つきは 5 つのネットワークをアンサンブル
![Page 31: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/31.jpg)
05/02/2023 31
• Scale Mixture を入れた Bayes by Backprop と SGD+Dropout(Hinton et al.) が同程度の性能( Test Error : 1.3%)
• SGD+Dropout(Hinton et al.) は6万データ全てを学習に回している
• Bayes by Backprop は 5万データしか使っていないが同程度の性能が出ている
5.1 Classification on MNIST
![Page 32: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/32.jpg)
05/02/2023 32
5.1 Classification on MNIST
•隠れ層 : 2層•ユニット数は全て 1200
![Page 33: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/33.jpg)
05/02/2023 33
• SGD は最も早く収束•早い段階で低いエラーを記録して,
以後は過学習
• Dropout と Bayes by Backprop が同様に収束
• Bayes by Backprop は Dropout の約 2 倍時間がかかる• しかし, 600epoch 後は Dropout より優れたテストエラーに収束
5.1 Classification on MNIST
![Page 34: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/34.jpg)
05/02/2023 34
• 学習後の重みの分布をヒストグラムで表示
5.1 Classification on MNIST
![Page 35: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/35.jpg)
05/02/2023 35
• Dropout や Bayes by Backprop で正則化されたネットワーク•ゼロが中心であることは SGD と同様
• 分布の裾 ( 分散 ) が大きくなっている
• Bayes by Backprop は最大の範囲の重みを使用している
5.1 Classification on MNIST
![Page 36: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/36.jpg)
05/02/2023 36
• ネットワークの冗長性を調べるために重みの変分事後分布をゼロに固定
•訓練済みのネットワークに対し,重みを SN 比 に変換
• 最小の SN 比で重みを除去
• 重みを 95% 取り除いても性能はほとんど変わらない
5.1 Classification on MNIST
![Page 37: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/37.jpg)
05/02/2023 37
•隠れ層: 2層•ユニット数: 1200個
5.1 Classification on MNIST
![Page 38: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/38.jpg)
05/02/2023 38
• Table2 の検証について,SN 比と密度をグラフ化
5.1 Classification on MNIST75% Cutoff
![Page 39: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/39.jpg)
05/02/2023 39
• Table2 の検証について,SN 比と CDF(累積密度 ) をグラフ化
5.1 Classification on MNIST75% Cutoff
![Page 40: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/40.jpg)
05/02/2023 40
• 75% のカットオフが 2 つのピークを分離する
• Table2 からも 75% のカットオフから性能の低下が始まることがわかる
• SN 比によるヒューリスティックがテスト性能に影響を及ぼしている
• 他の研究に比べて,性能を落とすことなく多くの重みを消去できる
5.1 Classification on MNIST
![Page 41: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/41.jpg)
05/02/2023 41
• ノイズが挿入されている次の曲線を学習
• 二乗誤差を最小化するタスク
• データが少ない区間に大きな違い• Bayes by Backprop は分散が広がる
•通常の NN はデータ点が少ない場合も分散を小さくしようとする
5.2 Regression curves
![Page 42: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/42.jpg)
05/02/2023 42
•赤線 : 推定の平均,青 /紫 : 四分位範囲
5.2 Regression curves
![Page 43: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/43.jpg)
05/02/2023 43
• UCI Mushrooms データセットを使用• 各キノコには食用 /毒性のラベルが付与
• エージェントのアクションはキノコを食べるか,食べないか•食用キノコを食べると +5 の報酬
•毒性キノコを食べると 1/2 で -35 の報酬,それ以外は +5
•食べない場合,報酬はゼロ
5.3 Bandits on Mushroom Task
![Page 44: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/44.jpg)
05/02/2023 44
•食用キノコの期待値は +5•毒性キノコの期待値は -15• リグレットはオラクルの報酬と
エージェントの報酬の差で測定• オラクルが食用キノコを食べると +5 の報酬
• オラクルが毒性キノコを食べると 0 の報酬
•隠れ層 2層 (ユニット数 100個 ) のNN を使用
5.3 Bandits on Mushroom Task
![Page 45: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/45.jpg)
05/02/2023 45
• リグレットの累積和をグラフ化
5.3 Bandits on Mushroom Task
![Page 46: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/46.jpg)
05/02/2023 46
•貪欲法で行動するエージェントは,最初キノコを食べようとしない• データがそろうと (1000Step ほど )キノコを食べ始め,リグレットの上昇が小さくなる
• Bayes by Backprop のエージェントは,
はじめからキノコを食べる• ほぼフラットなリグレットで収束
5.3 Bandits on Mushroom Task
![Page 47: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/47.jpg)
05/02/2023 47
• Bayes by Backprop という重みに不確実さを持つ NN を学習するアルゴリズムを提案
• MNIST では Dropout と同程度の性能
• 非線形回帰では不確実性によってデータの少ない区間で合理的な予測が可能に
• Contextual Bandits では,探索と活用のトレードオフを自動的に学習
6. Discussion
![Page 48: 論文紹介(Weight Uncertainty in Neural Networks)](https://reader036.vdocuments.pub/reader036/viewer/2022062316/587152151a28ab8e5b8b46a1/html5/thumbnails/48.jpg)
05/02/2023 48
• Bayes by Backprop は,シンプルな勾配更新を使っている• 非同期処理や分散処理でスケールしやすい
• GPU で容易に実装が可能である
6. Discussion