らんだむな記憶

blogというものを体験してみようか!的なー

ニューラルネットワーク (2)

活性化関数は全部シグモイド関数$\varsigma(\cdot)$としておく。
ネットワークは入力層, 中間層, 出力層の3層構成としておく。
入力層のユニット数を$s_1$, 中間層のユニット数を$s_2$, 出力層のユニット数を1とでもする。
入力を$x = (x_1, \cdots, x_{s_1})^T$として、$x_0 = 1$を入力段階でのバイアスとして、入力層での重みを$\Theta^1$とする。
\begin{equation}
a^2 = \varsigma(\Theta^1 \widetilde{x})
\end{equation}
が中間層への入力たるactivationになる。ここで$\widetilde{x} = (x_0, x_1, \cdots, x_{s_1})^T$とする。
$\Theta^1$を成分ごとに書くと、$s_2 \times (s_1 + 1)$-行列になって、以下のような表示になる。
\begin{equation}
\Theta^1 =
\begin{pmatrix}
\theta_{10}^1 & \theta_{11}^1 & \cdots & \theta_{1 s_1}^1 \\
\theta_{20}^1 & \theta_{21}^1 & \cdots & \theta_{2 s_1}^1 \\
& \vdots & \ddots & \\
\theta_{s_2 0}^1 & \theta_{s_2 1}^1 & \cdots & \theta_{s_2 s_1}^1 \\
\end{pmatrix}
\end{equation}
この行列の$i$行目を$\Theta_{i}^1 = (\theta_{i0}^1, \theta_{i1}^1, \cdots, \theta_{i s_1}^1)$と書くとして、中間層のactivationの第$i$成分は、
\begin{equation}
a_i^2 = \varsigma(\Theta_{i}^1 \widetilde{x}) \in [0,\ 1],\ 1 \le i \le s_2
\end{equation}
とも書ける。
更に中間層でのバイアス$a_0^2 = 1$を加えて$\widetilde{a^2} = (a_0^2, a_1^2, \cdots, a_{s_2}^2)^T$とする。
中間層での重みを$\Theta^2$とする。出力層のユニット数を1としたので、$1 \times (s_2 + 1)$-行列として以下になる。
\begin{equation}
\Theta^2 =
\begin{pmatrix}
\theta_{10}^2 & \theta_{11}^2 & \cdots & \theta_{1 s_2}^2
\end{pmatrix}
\end{equation}
で、
\begin{equation}
a^3 = \varsigma(\Theta^2 \widetilde{a^2}) \in [0,\ 1]
\end{equation}
が最終出力になる。即ち、hypothesis関数が$h_\Theta(x) = a^3$として求まる。

…と書いてみるとなんだこりゃーという勢いである。brbrgkgk...
一番シンプルなニューラルネットワークでも吐き気のするような感じだ。そろそろ頭に入らない...。