ラベル

AI Forecast 8306MUFG (211) 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 (5) emotion (5) Hiking (4) music (3) Statarb (2) piano (2)

2019年6月2日日曜日

ニューラルネット 実験環境で遊ぶ Play on Neural Net Playground

ニューラルネット 実験環境で遊ぶ

English Follows

テンソルフローが提供しているニューラルネットで遊べる環境があるので、遊んでみよう。推定するテスト関数(教師データ)は次の4つから選ぶ。


ここで一番難しい渦巻き(上図4)を選んでみる。入力を前処理(下図では2乗、積、SIN/COSなど)した関数を与えると、非線形部分を関数が受け持ってくれるので、前処理関数がテスト関数に当たっていればニューロン数は少なくて済む。当たるというのは、渦巻きに関係ある関数かどうかという意味である。

下の例では、収束計算8,027回後に、オレンジと水色が概ね入力データを正しく包み収束していることが分かる。


ただ、このような前処理の関数を与えてしまうと、問題が特定されている場合はより少ない負荷で収束することができるが、これは人が関数選択に介入しているため、ニューラルネットの価値が半減している。

では、ニューラルネットにガチで学習させるとどうなるだろうか?下図の例では、前処理の関数を無くし、入力はXのダイレクトのみ。その代わりに、中間層のニューロンを4つ増やしている(因みに中間層を増やさないと収束しない)。収束計算6,788回後に、オレンジと水色が概ね入力データを正しく包み収束していることが分かる。


以上の実験で、ニューラルネットはニューロンおよび層の数を増やせば、どのような関数でも近似的にエミュレートできるであろうことがわかる。


Play on Neural Net Playground


Let's play on neural net playground that Tensoflow provides. Choose test function (teacher data) to learn from four functions provided as below.



Let's choose most difficult function here, i.e., swirl (see 4 in above figure). If pre-processing functions (square, product, sin/cos as in below picture) is provided, since non-linear parts are taken care of by those, if such pre-processing function well hit test function, then less neurons are required. Hit means that pre-processing functions are relevant to the target test function.

In below example, after 8,027 iterations, orange and blue zones correctly wrapped up input data, i.e., convergence was achieved.



However, although such pre-processing function can optimize convergence process when target function is known, it means a human interaction to decide target function, then it makes less value on neural net.

By the way, what will happen if we let neural net makes serious outright challenge?  In below example, pre-processing functions were eliminated, leaving only direct inputs of X. Instead however, neurons were increased by four in hidden layer (unless otherwise it will not converge). After 6,788 iterations, orange and blue zones correctly wrapped up input data, i.e., convergence was achieved.


Above experiment shows neural net can make approximate emulation on any kind of function by increasing number of neurons and hidden layers.