「.NET 開発基盤部会 Wiki」は、「Open棟梁Project」,「OSSコンソーシアム .NET開発基盤部会」によって運営されています。
「重み」のパラメタ(w1, w2, θ(-b))の決定は人手によって行われる。
という問題を、データから自動で「重み」のパラメタを学習することで解決する。
第0層 第1層 第2層~ 入力層 → 中間層(隠れ層) → 出力層
そのままの値を出力(出力に重みを掛けられる。
入出力変換後、重みを掛けて多分岐。
0、1の間の値に変換(全部の和が1となるように正規化する場合もある
出力と教師信号の誤差の計算をし、
2→1→0層と層の重みを更新していく(誤差逆伝播法?)
ステップ関数とシグモイド関数とReLU関数がある。
なんとなくAPI仕様を知らないと難しい感じ。
"""This is a test program."""
import numpy as np
def step_function(x_1):
"""This is a test program."""
y_1 = x_1 > 0
return y_1.astype(np.int)"""This is a test program."""
import numpy as np
def step_function(x_1):
"""This is a test program."""
return np.array(x_1 > 0, dtype=np.int)-5.0 ~ 5.0までの0.1刻みのプロットをステップ関数にかけてグラフ化する。
"""This is a test program."""
import numpy as np
import matplotlib.pylab as plt
def step_function(x_1):
"""This is a test program."""
# 上記のいずれかの実装を選択。
X = np.arange(-5.0, 5.0, 0.1)
Y = step_function(X)
plt.plot(X, Y)
plt.ylim(-0.1, 1.1) # 図で描画するy軸の範囲を指定
plt.show()
1
h(x) = ────────
1 + exp(-x)
ポイントは、Pythonのブロードキャストによって配列も計算できる点。
"""This is a test program."""
import numpy as np
def sigmoid(x_1):
"""This is a test program."""
return 1 / (1 + np.exp(-x_1))
-5.0 ~ 5.0までの0.1刻みのプロットをシグモイド関数にかけてグラフ化する。
"""This is a test program."""
import numpy as np
import matplotlib.pylab as plt
def sigmoid(x_1):
"""This is a test program."""
return 1 / (1 + np.exp(-x_1))
X = np.arange(-5.0, 5.0, 0.1)
Y = sigmoid(X)
plt.plot(X, Y)
plt.ylim(-0.1, 1.1)
plt.show()
ReLU(Rectified Linear Unit)関数
┌
│0 ( a <= 0 )
y = h(a) = <
│a ( a > 0 )
└
"""This is a test program."""
import numpy as np
def relu(x_1):
"""This is a test program."""
return np.maximum(0, x)
-5.0 ~ 5.0までの0.1刻みのプロットをReLU関数にかけてグラフ化する。
"""This is a test program."""
import numpy as np
import matplotlib.pylab as plt
def relu(x_1):
"""This is a test program."""
return np.maximum(0, x_1)
X = np.arange(-5.0, 5.0, 0.1)
Y = relu(X)
plt.plot(X, Y)
plt.ylim(-0.1, 5.1)
plt.show()
(Convolutional Neural Network: CNN)
CNNは、畳み込み層とプーリング層の重ね合わせ。
画像内の全画素にラベルやカテゴリを関連付けるアルゴリズム
(Recurrent Neural Network: RNN)
(Long short-term memory: LSTM)
(Generative Adversarial Network: GAN)
識別NNの識別エラーが50%になるように、生成NNが学習する。
(Deep Q-Network: DQN)