Bidirectional sequence models

MegMit report abuse

I know about such neural networks as LSTM and GRU, which are good for working with sequence data. But recently I learned about Bidirectional wrapper of these models in Keras. What is this wrapper for and where should be used?

Answers

Bonnie_Mar report abuse

It is for looking at sequences not only from the beginning to the end but also in the opposite direction, from the end to the beginning. It can be good for such situations where we can derive some benefit from looking at the later data prior to looking at the earlier data.

MegMit report abuse

Could you provide an example of such a situation, please?

WKhan04 report abuse

Suppose you need to build an NLP model for predicting the next word in the sentence. In many cases, the next word depends more on the words closely located to it (to the end of the current sentence). But there can be situations where the next word should be predicted after taking into account the words located further from the end of the sentence. Maybe these 2 sentences will help you to understand what am I speaking about:

  1. My car has four driving wheels.
  2. My car, which I used to travel across Europe, had four driving wheels.

The part of the sentence about the wheels ("4 driving wheels") really depends on the part of the sentence about the car ("my car"). But in the first case, there is nothing between these parts, and in the second case, they are separated by the insertion of about the trip to Europe.

Bidirectional wrapper explores the sentence from both ends, which helps to understand the gist of the sentence better and make the correct prediction.

Add Answer

Need support?

Just drop us an email to ... Show more