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)

Building deep learning models

The core data structure of Keras is a model, which is a way to organize layers. There are two types of model:

  • Sequential: The main type of model. It is simply a linear stack of layers.
  • Keras functional API: These are used for more complex architectures.

You define a sequential model as follows:

from keras.models import Sequential
model = Sequential()

Once a model is defined, you can add one or more layers. The stacking operation is provided by the add() statement:

from keras.layers import Dense, Activation

For example, add a first fully connected NN layer and the Activation function:

model.add(Dense(output_dim=64, input_dim=100))
model.add(Activation("relu"))

Then add a second softmax layer:

model.add(Dense(output_dim=10))
model.add(Activation("softmax"))

If the model looks fine, you must compile the model by using the model.compile function, specifying the loss...