history model fit(x_trainy_trainepochs= batch_size= validation_split= you get performance nearly identical to that of the chronological-order lstm remarkablyon such text datasetreversed-order processing works just as well as chronological processingconfirming the hypothesis thatalthough word order does matter in understanding languagewhich order you use isn' crucial importantlyan rnn trained on reversed sequences will learn different representations than one trained on the original sequencesmuch as you would have different mental models if time flowed backward in the real world--if you lived life where you died on your first day and were born on your last day in machine learningrepresentations that are different yet useful are always worth exploitingand the more they differthe betterthey offer new angle from which to look at your datacapturing aspects of the data that were missed by other approachesand thus they can help boost performance on task this is the intuition behind ensemblinga concept we'll explore in bidirectional rnn exploits this idea to improve on the performance of chronologicalorder rnns it looks at its input sequence both ways (see figure )obtaining potentially richer representations and capturing patterns that may have been missed by the chronological-order version alone input data merge (addconcatenaternn rnn abcde edcba chronological sequence abcde reversed sequence figure how bidirect ional rnn layer works to instantiate bidirectional rnn in kerasyou use the bidirectional layerwhich takes as its first argument recurrent layer instance bidirectional creates secondseparate instance of this recurrent layer and uses one instance for processing the input sequences in chronological order and the other instance for processing the input sequences in reversed order let' try it on the imdb sentiment-analysis task listing training and evaluat ing bidirectional lstm model sequential(model add(layers embedding(max_features )model add(layers bidirectional(layers lstm( ))model add(layers dense( activation='sigmoid')licensed to