Deep Learning with Theano by Christopher Bourez

Deep Learning with Theano by Christopher Bourez

Author:Christopher Bourez [Bourez, Christopher]
Language: eng
Format: azw3, pdf
Publisher: Packt Publishing
Published: 2017-07-31T04:00:00+00:00


We can save some memory:

del train_tweets, dev_tweets

Keras provides a helper method to pad the sequences to ensure they all have the same length, so that a batch of sequences can be represented by a tensor, and use optimized operations on tensors, either on a CPU or on a GPU.

By default, the method pads at the beginning, which helps get us better classification results:

from keras.preprocessing.sequence import pad_sequences X_train = pad_sequences(X_train, maxlen=max_len, truncating='post') X_dev = pad_sequences(X_dev, maxlen=max_len, truncating='post')



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.