deep learning for text and sequences figure training and validation loss on the jena emperat ureforecasting task with gru rained on reversed sequences the reversed-order gru strongly underperforms even the common-sense baselineindicating that in this casechronological processing is important to the success of your approach this makes perfect sensethe underlying gru layer will typically be better at remembering the recent past than the distant pastand naturally the more recent weather data points are more predictive than older data points for the problem (that' what makes the common-sense baseline fairly strongthus the chronological version of the layer is bound to outperform the reversed-order version importantlythis isn' true for many other problemsincluding natural languageintuitivelythe importance of word in understanding sentence isn' usually dependent on its position in the sentence let' try the same trick on the lstm imdb example from section listing training and evaluat ing an lstm using reversed sequences from keras datasets import imdb from keras preprocessing import sequence from keras import layers number of words from keras models import sequential to consider as features max_features maxlen loads data cuts off texts after this number of words (among the max_features most common words(x_trainy_train)(x_testy_testimdb load_datanum_words=max_featuresx_train [ [::- for in x_trainx_test [ [::- for in x_testreverses sequences x_train sequence pad_sequences(x_trainmaxlen=maxlenx_test sequence pad_sequences(x_testmaxlen=maxlenmodel sequential(model add(layers embedding(max_features )model add(layers lstm( )model add(layers dense( activation='sigmoid')model compile(optimizer='rmsprop'loss='binary_crossentropy'metrics=['acc']licensed to pads sequences