0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

深層学習 Day 3 - Section 4 双方向RNN のまとめ

0
Last updated at Posted at 2020-11-20

この記事は個人的なお勉強用のメモです。

このお勉強の位置

深層学習 Day 3

Section 1 再帰型ニューラルネットワークの概念
Section 2 LSTM
Section 3 GRU
Section 4 双方向RNN ← これ
Section 5 Seq2Seq
Section 6 Word2vec
Section 7 Attention Mechanism

講義

双方向RNN

過去の情報だけでなく、未来の情報を加味することで
精度を向上。

例
・文章の推敲
・機械翻訳

演習チャレンジ

def bidirectional_rnn_net(xs, W_f, U_f, W_b, U_b, V):
  xs_f = np.zeros_like(xs)
  xs_b = np.zeros_like(xs)
  for i, x in enumerate(xs):
    xs_f[i] = x
    xs_b[i] = x[::-1]
  hs_f = _rnn(xs_f, W_f, U_f)
  hs_b = _rnn(xs_b, W_b, U_b)
  hs = [np.concatenate([h_f, h_b], axis=1) for h_f, h_b in zip(hs_f, hs_b)]
  ys = hs.dot(V.T)
  return ys

変数名について。
f は forward(順方向)であり、b は backward(逆方向)の頭文字か。

順方向で求めた隠れ状態と、逆方向で求めた隠れ状態を右方向(axis=1)に連結し、
その値を隠れ状態とする。

実装演習

なし

確認テスト

なし

修了テスト~練習問題~

修了テスト内に双方向RNNに関する問題なし。
代わりに赤本2で勉強。

双方向RNNは、周囲の情報をバランスよく含ませる仕組みのこと。
順方向と逆方向のそれぞれで学習して、それぞれの隠れ状態を求め、
これらの隠れ状態を連結することで最終的な隠れ状態とする。
連結以外にも、和や平均がありうる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?