プリンキピア

第5章多層パーセプトロン

5.3.1. Forward Propagation5.3.1 順伝播

Forward propagation (or forward pass) refers to the calculation and storage of intermediate variables (including outputs) for a neural network in order from the input layer to the output layer. We now work step-by-step through the mechanics of a neural network with one hidden layer. This may seem tedious but in the eternal words of funk virtuoso James Brown, you must “pay the cost to be the boss”.
英語のヒント
順伝播(あるいは順方向パス)とは、ニューラルネットワークについて、入力層から出力層へ順に、中間変数(出力を含む)を計算して保存することをいう。ここでは、隠れ層が一つのニューラルネットワークの仕組みを一歩ずつたどる。退屈に思えるかもしれないが、ファンクの名手ジェームス・ブラウンの不朽の言葉を借りれば、「ボスになるには代価を払わなければならない」のである。
For the sake of simplicity, let’s assume that the input example is 𝐱∈ℝd and that our hidden layer does not include a bias term. Here the intermediate variable is:
英語のヒント
簡単のため、入力の事例は𝐱∈ℝdで、隠れ層はバイアス項を含まないと仮定しよう。このとき、中間変数は次のとおりである。
𝐳=𝐖(1)𝐱,(5.3.1)
where 𝐖(1)∈ℝh×d is the weight parameter of the hidden layer. After running the intermediate variable 𝐳∈ℝh through the activation function ϕ we obtain our hidden activation vector of length h:
英語のヒント
ここで𝐖(1)∈ℝh×dは隠れ層の重みパラメータである。中間変数𝐳∈ℝhを活性化関数ϕに通すと、長さhの隠れ層の活性ベクトルが得られる。
𝐡=ϕ(𝐳).(5.3.2)
The hidden layer output 𝐡 is also an intermediate variable. Assuming that the parameters of the output layer possess only a weight of 𝐖(2)∈ℝq×h, we can obtain an output layer variable with a vector of length q:
英語のヒント
隠れ層の出力𝐡も中間変数である。出力層のパラメータが重み𝐖(2)∈ℝq×hだけをもつと仮定すると、長さqのベクトルである出力層の変数が得られる。
𝐨=𝐖(2)𝐡.(5.3.3)
Assuming that the loss function is l and the example label is y, we can then calculate the loss term for a single data example,
英語のヒント
損失関数をl、事例のラベルをyとすると、一つのデータ事例についての損失項を次のように計算できる。
L=l(𝐨,y).(5.3.4)
As we will see the definition of ℓ2 regularization to be introduced later, given the hyperparameter λ, the regularization term is
英語のヒント
後で紹介するℓ2正則化の定義でわかるように、ハイパーパラメータλが与えられたとき、正則化項は次のようになる。
s=λ2(∥𝐖(1)∥F2+∥𝐖(2)∥F2),(5.3.5)
where the Frobenius norm of the matrix is simply the ℓ2 norm applied after flattening the matrix into a vector. Finally, the model’s regularized loss on a given data example is:
英語のヒント
ここで、行列のフロベニウスノルムは、行列を平らにしてベクトルにした後に当てはめるℓ2ノルムにすぎない。最後に、与えられたデータ事例についてのモデルの正則化された損失は次のとおりである。
J=L+s.(5.3.6)
We refer to J as the objective function in the following discussion.
英語のヒント
以下の議論では、Jを目的関数と呼ぶ。