Book Image

Deep Learning with TensorFlow

By : Giancarlo Zaccone, Md. Rezaul Karim, Ahmed Menshawy
Book Image

Deep Learning with TensorFlow

By: Giancarlo Zaccone, Md. Rezaul Karim, Ahmed Menshawy

Overview of this book

Deep learning is the step that comes after machine learning, and has more advanced implementations. Machine learning is not just for academics anymore, but is becoming a mainstream practice through wide adoption, and deep learning has taken the front seat. As a data scientist, if you want to explore data abstraction layers, this book will be your guide. This book shows how this can be exploited in the real world with complex raw data using TensorFlow 1.x. Throughout the book, you’ll learn how to implement deep learning algorithms for machine learning systems and integrate them into your product offerings, including search, image recognition, and language processing. Additionally, you’ll learn how to analyze and improve the performance of deep learning models. This can be done by comparing algorithms against benchmarks, along with machine intelligence, to learn from the information and determine ideal behaviors within a specific context. After finishing the book, you will be familiar with machine learning techniques, in particular the use of TensorFlow for deep learning, and will be ready to apply your knowledge to research or commercial projects.
Table of Contents (11 chapters)

Adding a convolutional layer

We can add one-dimensional CNN and max-pooling layers after the embedding layer, which will then feed the consolidated features to the LSTM.

Here is our embedding layer:

model = Sequential() 
model.add(Embedding(top_words,\
embedding_vector_length,\
input_length=max_review_length))

We can apply a convolution layer with a small kernel filter (filter_length) of size 3, with 32 output features (nb_filter):

model.add(Conv1D (padding="same", activation="relu", kernel_size=3,\ num_filter=32))

Next, we add a pooling layer; the size of the region to which max pooling is applied is equal to 2:

model.add(GlobalMaxPooling1D ())

The next layer is a LSTM layer, with 100 memory units:

model.add(LSTM(100))

The final layer is a Dense output layer, with a single neuron and a sigmoid activation function, to make 0 or 1 predictions for the two classes (good...