Module Expr Str ImportFrom alias Import alias identifier Expr Call AttributeLoad AttributeLoad NameLoad attr attr Num ImportFrom alias ImportFrom alias ImportFrom alias alias alias alias alias alias ImportFrom alias Assign NameStore Num Assign NameStore Num Assign NameStore Num Expr Call NameLoad Str Assign TupleStore TupleStore NameStore NameStore TupleStore NameStore NameStore Call AttributeLoad NameLoad attr keyword NameLoad keyword Num Expr Call NameLoad Call NameLoad NameLoad Str Expr Call NameLoad Call NameLoad NameLoad Str Expr Call NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Expr Call NameLoad Str AttributeLoad NameLoad attr Expr Call NameLoad Str AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad keyword TupleLoad NameLoad keyword Str Assign NameStore Call Call NameLoad NameLoad Num keyword NameLoad NameLoad Assign NameStore Call Call NameLoad Num NameLoad Assign NameStore Call Call NameLoad Num keyword NameLoad NameLoad Assign NameStore Call NameLoad ListLoad NameLoad NameLoad keyword Str keyword Num Assign NameStore Call Call NameLoad Num NameLoad Assign NameStore Call Call NameLoad Num keyword Str NameLoad Assign NameStore Call NameLoad keyword NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr Str Str keyword ListLoad Str Expr Call NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad keyword NameLoad keyword Num keyword ListLoad NameLoad NameLoad
N/A N/A Train a Bidirectional LSTM on the IMDB sentiment classification task.

Output after 4 epochs on CPU: ~0.8146
Time per epoch on CPU (Core i7): ~150s.
 __future__ print_function N/A numpy np N/A N/A N/A N/A np random seed 1337 keras.preprocessing sequence keras.models Model keras.layers Dense Dropout Embedding LSTM Input merge keras.datasets imdb N/A max_features 20000 N/A maxlen 100 N/A batch_size 32 N/A N/A print Loading data... N/A N/A N/A X_train y_train N/A X_test y_test N/A N/A imdb load_data nb_words max_features test_split 0.2 N/A N/A print N/A len X_train train sequences N/A N/A print N/A len X_test test sequences N/A N/A print Pad sequences (samples x time) N/A X_train N/A N/A sequence pad_sequences X_train maxlen maxlen N/A X_test N/A N/A sequence pad_sequences X_test maxlen maxlen N/A N/A print X_train shape: N/A X_train shape N/A N/A print X_test shape: N/A X_test shape N/A y_train N/A N/A np array y_train N/A y_test N/A N/A np array y_test N/A sequence N/A Input shape N/A maxlen dtype int32 N/A embedded N/A N/A Embedding max_features 128 input_length maxlen sequence N/A forwards N/A N/A LSTM 64 embedded N/A backwards N/A N/A LSTM 64 go_backwards True embedded N/A merged N/A merge N/A forwards backwards mode concat concat_axis -1 N/A after_dp N/A N/A Dropout 0.5 merged N/A output N/A N/A Dense 1 activation sigmoid after_dp N/A model N/A Model input sequence output output N/A N/A N/A model compile adam binary_crossentropy metrics N/A accuracy N/A N/A print Train... N/A N/A N/A model fit X_train y_train batch_size batch_size nb_epoch 4 validation_data N/A X_test y_test