ラベル

AI Forecast 8306MUFG (213) Social (75) life (70) Financial (62) IT (57) Proposal (56) idea (50) Fund Management (48) Trading (43) economics (42) Covid-19 (40) AI (38) Hedge Fund (36) Risk (36) Culture (31) BOJ (29) Science (26) hobby (24) accounting (17) Apps (16) career (11) job (7) Travel (6) Hiking (5) emotion (5) music (3) Statarb (2) piano (2)

2020年2月13日木曜日

Tensorflow.js 正規化の効用 Tensorflow.js Impact by Normalization

Tensorflow.js 正規化の効用 Tensorflow.js Impact of Normalization



Tensorflowは数あるAIエンジンの一つであり、本ブログでは、そのJavascript版を利用している。Tensorflow, that this blog makes use of, is one of several other major AI engines.

Tensorflowに限ったことはないと思うが、AIエンジンは収束計算を行う際に最急降下法を使うため、微分の値が飛ばないように入力値を管理しないと、収束が良くない。This should not be limited to Tensorflow only but in general, input value needs to be controlled so that steepest gradient converges in AI engine.

AIエンジンの機能として初めから標準装備されていれば問題ないのだが、現状ではAPI 利用者が正規化を行う必要がある。最大最小の中の範囲を[-1,1]で表すなどいろいろな方法はあるが、ここでは2次モーメント情報(分散)をもとに、標準正規分布への写像を行う方法を使った。If AI engine has normalization function by default it will be no issue but as of now, such normalization needs to be done by API users.  There are number of ways to do normalization such as using max/min to project to [-1,1] however, here we use standard normal distribution approach based on 2nd order information, that is variance.


\begin{align}  X' &= \frac{X - \mu}{\sigma }(標準偏差) \\ & \end{align} \begin{align} X'   &:  Varible In Normalized Space(正規化空間の変数)  \\X   &:  VariableInOriginalSpace(元の空間の変数) \\ \mu   &:  Average(平均値) \\ \sigma  &:  StandardDeviation(標準偏差) \end{align}

その結果、先に掲載したPOCツールは早く正確に収束するようになった。上図は、四角形の真ん中が-10と凹み、周辺が+10と高くなっているデータを教育した結果比較だ。右は現データをそのままTensorflowで処理したケース、左は、正規化後、Tensorflowで処理したケースである。正規化した方がデータをよく表していることがわかる。As a result, POC tool presented earlier started to show better convergence. Picture above is the comparison result of education of rectangular surface where value is 10 at peripheral while -10 in center. Right picture is without normalization while left picture is with normalization. It is observed that normalization result shows better presentation of data space.