第10章現代のリカレントニューラルネットワーク
10.1.1. Gated Memory Cell10.1.1 ゲート付きメモリセル
Each memory cell is equipped with an internal state and a number of multiplicative gates that determine whether (i) a given input should impact the internal state (the input gate), (ii) the internal state should be flushed to (the forget gate), and (iii) the internal state of a given neuron should be allowed to impact the cell’s output (the output gate).
英語のヒント
各メモリセルは、内部状態と、いくつかの乗算のゲートを備えている。ゲートは、(i)与えられた入力が内部状態に影響すべきか(入力ゲート)、(ii)内部状態をに流し去るべきか(忘却ゲート)、(iii)あるニューロンの内部状態がセルの出力に影響するのを許すべきか(出力ゲート)を決める。
10.1.1.2. Input Gate, Forget Gate, and Output Gate10.1.1.2 入力ゲート、忘却ゲート、出力ゲート
The data feeding into the LSTM gates are the input at the current time step and the hidden state of the previous time step, as illustrated in Fig. 10.1.1. Three fully connected layers with sigmoid activation functions compute the values of the input, forget, and output gates. As a result of the sigmoid activation, all values of the three gates are in the range of . Additionally, we require an input node, typically computed with a tanh activation function. Intuitively, the input gate determines how much of the input node’s value should be added to the current memory cell internal state. The forget gate determines whether to keep the current value of the memory or flush it. And the output gate determines whether the memory cell should influence the output at the current time step.
英語のヒント
LSTMのゲートに入るデータは、図10.1.1に示すように、現在の時間ステップの入力と前の時間ステップの隠れ状態である。シグモイド活性化関数をもつ三つの全結合層が、入力ゲート、忘却ゲート、出力ゲートの値を計算する。シグモイド活性化の結果、三つのゲートの値はすべての範囲にある。さらに、入力ノードが必要であり、これはふつうtanh活性化関数で計算される。直観的には、入力ゲートは、入力ノードの値のどれだけを現在のメモリセルの内部状態に加えるべきかを決める。忘却ゲートは、メモリの現在の値を保つか流し去るかを決める。そして出力ゲートは、メモリセルが現在の時間ステップの出力に影響すべきかどうかを決める。
Fig. 10.1.1図10.1.1
Computing the input gate, the forget gate, and the output gate in an LSTM model.
英語のヒント
LSTMモデルで、入力ゲート、忘却ゲート、出力ゲートを計算する。
Mathematically, suppose that there are hidden units, the batch size is , and the number of inputs is . Thus, the input is and the hidden state of the previous time step is . Correspondingly, the gates at time step are defined as follows: the input gate is , the forget gate is , and the output gate is . They are calculated as follows:
英語のヒント
数学的には、隠れユニットが個、バッチサイズが、入力の数がだとする。すると、入力は、前の時間ステップの隠れ状態はである。これに対応して、時間ステップのゲートは次のように定義される。入力ゲートは、忘却ゲートは、出力ゲートはである。これらは次のように計算される。
(10.1.1)
where and are weight parameters and are bias parameters. Note that broadcasting (see Section 2.1.4) is triggered during the summation. We use sigmoid functions (as introduced in Section 5.1) to map the input values to the interval .
英語のヒント
10.1.1.3. Input Node10.1.1.3 入力ノード
Next we design the memory cell. Since we have not specified the action of the various gates yet, we first introduce the input node . Its computation is similar to that of the three gates described above, but uses a function with a value range for as the activation function. This leads to the following equation at time step :
英語のヒント
次に、メモリセルを設計する。さまざまなゲートの働きはまだ指定していないので、まず入力ノードを導入する。その計算は上で説明した三つのゲートのものと似ているが、活性化関数として値の範囲がの関数を使う。これにより、時間ステップで次の式が得られる。
(10.1.2)
where and are weight parameters and is a bias parameter.
英語のヒント
ここで、とは重みパラメータ、はバイアスパラメータである。
Fig. 10.1.2図10.1.2
Computing the input node in an LSTM model.
英語のヒント
LSTMモデルで、入力ノードを計算する。
10.1.1.4. Memory Cell Internal State10.1.1.4 メモリセルの内部状態
In LSTMs, the input gate governs how much we take new data into account via and the forget gate addresses how much of the old cell internal state we retain. Using the Hadamard (elementwise) product operator we arrive at the following update equation:
英語のヒント
LSTMでは、入力ゲートがを通じて新しいデータをどれだけ考慮に入れるかを左右し、忘却ゲートが古いセルの内部状態のどれだけを保つかを扱う。アダマール(要素ごとの)積の演算子を使うと、次の更新式にたどり着く。
(10.1.3)
If the forget gate is always 1 and the input gate is always 0, the memory cell internal state will remain constant forever, passing unchanged to each subsequent time step. However, input gates and forget gates give the model the flexibility of being able to learn when to keep this value unchanged and when to perturb it in response to subsequent inputs. In practice, this design alleviates the vanishing gradient problem, resulting in models that are much easier to train, especially when facing datasets with long sequence lengths.
英語のヒント
忘却ゲートがいつも1で、入力ゲートがいつも0なら、メモリセルの内部状態はいつまでも一定のままで、変わらずに続く各時間ステップへ渡される。しかし、入力ゲートと忘却ゲートは、この値をいつ変えずに保ち、いつ後続の入力に応じて乱すかを学習できる柔軟さをモデルに与える。実際には、この設計は勾配消失の問題を和らげ、特に系列の長いデータセットに直面したときに、ずっと訓練しやすいモデルをもたらす。
Fig. 10.1.3図10.1.3
Computing the memory cell internal state in an LSTM model.
英語のヒント
LSTMモデルで、メモリセルの内部状態を計算する。