自動微分
Automatic differentiation
プログラムで定義された関数を解析し、偏導関数の値を計算するプログラムを導出する技術 ref
数学的に正確
フォワードモードの自動微分
計算グラフの入力から出力向かって計算する
ある入力が各ノードにどのように作用するのかを追跡する
全ての各ノードに$ \frac{\partial}{\partial 入力}を適用する
出力の次元が入力の次元より大きいときは効率がいい
悪い方の例
100万の入力、1つの出力のとき
微分係数を得るためにグラフを100万回行き来する必要がある
http://colah.github.io/posts/2015-08-Backprop/img/chain-forward-greek.png
各ノードで$ \frac{\partial}{\partial X}が求まる
リバースモードの自動微分
グラフの出力から入力へ向かって計算する
各ノードがある出力にどう作用するのかを追跡する
全ての各ノードに$ \frac{\partial 出力}{\partial}を適用する
入力の次元が出力の次元より大きいときは効率がいい
ニューラルネットワークでは、入力の次元が大きいことが多いので、よくこちらが使われる
http://colah.github.io/posts/2015-08-Backprop/img/chain-backward-greek.png
各ノードで$ \frac{\partial Z}{\partial}が求まる
二重数
用途
機械学習フレームワーク
自動車工学
気候モデリング
etc.
Haskellで実装
自動微分を実装して理解する(前編) - Qiita
参考
Misreading Chat 9
計算グラフの微積分:バックプロパゲーションを理解する | POSTD
===============================================================
この辺の記事と統合する
https://mrsekut.site/?p=895
https://mrsekut.site/?p=1978
Generic GPU Kernels – Mike Innes
めっちゃ詳しい
http://rydotyosh.github.io/docs/adintro/index.html#1.0
https://twitter.com/i/moments/954711753220173830
https://en.wikipedia.org/wiki/Automatic_differentiation#Source_code_transformation_(SCT)
しらべる
これについて
http://rydotyosh.github.io/docs/adintro/index.html#8.0
http://norimune.net/3173
http://kivantium.hateblo.jp/entry/2016/03/25/010320
https://speakerdeck.com/lotz84/guan-shu-toxing-deli-jie-suruzi-dong-wei-fen
Haskellで実装
https://blog.7nobo.me/2018/03/10/02-dual-number-deriv.html
https://qiita.com/lotz/items/f1d4ab1d83dc13a5d81a
https://qiita.com/lotz/items/75e2705fdfc958852511
https://gist.github.com/ttesmer/948df432cf46ec6db8c1e83ab59b1b21
38行
pytorch
https://www.udemy.com/pytorch-deeplearning/learn/v4/content
参考
[https://ja.wikipedia.org/wiki/%E8%87%AA%E5%8B%95%E5%BE%AE%E5%88%86 ]
http://www.nag-j.co.jp/nagconsul/algorithmic-differentiation/ADtoha.htm
https://qiita.com/lotz/items/fd6c1c695fda6779585f
https://qiita.com/es__135/items/c7f774f6f0de8fc23530
rust