, , , LSTM , .
github :
model = Sequential()
model.add(LSTM(4,input_dim=5,input_length=N,return_sequences=True))
for e in zip(model.layers[0].trainable_weights, model.layers[0].get_weights()):
print('Param %s:\n%s' % (e[0],e[1]))
:
Param lstm_3_W_i:
[[ 0.00069305, ...]]
Param lstm_3_U_i:
[[ 1.10000002, ...]]
Param lstm_3_b_i:
[ 0., ...]
Param lstm_3_W_c:
[[-1.38370085, ...]]
...
. W, U, V b .
- W - , .
[input_dim, output_dim]
. - U - , .
[output_dim, output_dim]
. - b - .
[output_dim]
- V , , .
[output_dim, output_dim]
, 4 "" ( ).
gate gate: , (h_ {t-1}) (x), (C_ {t-1}):
f_t = (W_f * x + U_f * h_ {t-1} + b_f)
f_t - 0 1, , (= 1) (= 0) .
: , (h_ {t-1}) (x), (x):
i_t = (W_i * x + U_i * h_ {t-1} + b_i)
i_t - 0 1, , .
: , , input (x) (h_ {t-1}):
Ct_t = tanh (W_c * x + U_c * h_ {t-1} + b_c)
Ct_t - , (C_ {t-1}).
(C_t):
C_t = f_t * C_ {t-1} + i_t * Ct_t
, : , , , .
, , LSTM. LSTM, , . .
, , , . W-, . W_c , . W_o , ... , .
, W_c, , (i_t) ... , , , , .
- . , , , .
, :-)