Mastering TensorFlow 1.x: Advanced machine learning and deep learning concepts using TensorFlow 1.x and Keras

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author(s): Armando Fandango
Year: 2018

Language: English

Cover
Copyright and Credits
Packt Upsell
Foreword
Contributors
Table of Contents
Preface
Chapter 1: TensorFlow 101
What is TensorFlow?
TensorFlow core
Code warm-up - Hello TensorFlow
Tensors
Constants
Operations
Placeholders
Creating tensors from Python objects
Variables
Tensors generated from library functions
Populating tensor elements with the same values
Populating tensor elements with sequences
Populating tensor elements with a random distribution
Getting Variables with tf.get_variable()
Data flow graph or computation graph
Order of execution and lazy loading
Executing graphs across compute devices - CPU and GPGPU
Placing graph nodes on specific compute devices
Simple placement
Dynamic placement
Soft placement
GPU memory handling
Multiple graphs
TensorBoard
A TensorBoard minimal example
TensorBoard details
Summary
Chapter 2: High-Level Libraries for TensorFlow
TF Estimator - previously TF Learn
TF Slim
TFLearn
Creating the TFLearn Layers
TFLearn core layers
TFLearn convolutional layers
TFLearn recurrent layers
TFLearn normalization layers
TFLearn embedding layers
TFLearn merge layers
TFLearn estimator layers
Creating the TFLearn Model
Types of TFLearn models
Training the TFLearn Model
Using the TFLearn Model
PrettyTensor
Sonnet
Summary
Chapter 3: Keras 101
Installing Keras
Neural Network Models in Keras
Workflow for building models in Keras
Creating the Keras model
Sequential API for creating the Keras model
Functional API for creating the Keras model
Keras Layers
Keras core layers
Keras convolutional layers
Keras pooling layers
Keras locally-connected layers
Keras recurrent layers
Keras embedding layers
Keras merge layers
Keras advanced activation layers
Keras normalization layers
Keras noise layers
Adding Layers to the Keras Model
Sequential API to add layers to the Keras model
Functional API to add layers to the Keras Model
Compiling the Keras model
Training the Keras model
Predicting with the Keras model
Additional modules in Keras
Keras sequential model example for MNIST dataset
Summary
Chapter 4: Classical Machine Learning with TensorFlow
Simple linear regression
Data preparation
Building a simple regression model
Defining the inputs, parameters, and other variables
Defining the model
Defining the loss function
Defining the optimizer function
Training the model
Using the trained model to predict
Multi-regression
Regularized regression
Lasso regularization
Ridge regularization
ElasticNet regularization
Classification using logistic regression
Logistic regression for binary classification
Logistic regression for multiclass classification
Binary classification
Multiclass classification
Summary
Chapter 5: Neural Networks and MLP with TensorFlow and Keras
The perceptron
MultiLayer Perceptron
MLP for image classification
TensorFlow-based MLP for MNIST classification
Keras-based MLP for MNIST classification
TFLearn-based MLP for MNIST classification
Summary of MLP with TensorFlow, Keras, and TFLearn
MLP for time series regression
Summary
Chapter 6: RNN with TensorFlow and Keras
Simple Recurrent Neural Network
RNN variants
LSTM network
GRU network
TensorFlow for RNN
TensorFlow RNN Cell Classes
TensorFlow RNN Model Construction Classes
TensorFlow RNN Cell Wrapper Classes
Keras for RNN
Application areas of RNNs
RNN in Keras for MNIST data
Summary
Chapter 7: RNN for Time Series Data with TensorFlow and Keras
Airline Passengers dataset
Loading the airpass dataset
Visualizing the airpass dataset
Preprocessing the dataset for RNN models with TensorFlow
Simple RNN in TensorFlow
LSTM in TensorFlow
GRU in TensorFlow
Preprocessing the dataset for RNN models with Keras
Simple RNN with Keras
LSTM with Keras
GRU with Keras
Summary
Chapter 8: RNN for Text Data with TensorFlow and Keras
Word vector representations
Preparing the data for word2vec models
Loading and preparing the PTB dataset
Loading and preparing the text8 dataset
Preparing the small validation set
skip-gram model with TensorFlow
Visualize the word embeddings using t-SNE
skip-gram model with Keras
Text generation with RNN models in TensorFlow and Keras
Text generation LSTM in TensorFlow
Text generation LSTM in Keras
Summary
Chapter 9: CNN with TensorFlow and Keras
Understanding convolution
Understanding pooling
CNN architecture pattern - LeNet
LeNet for MNIST data
LeNet CNN for MNIST with TensorFlow
LeNet CNN for MNIST with Keras
LeNet for CIFAR10 Data
ConvNets for CIFAR10 with TensorFlow
ConvNets for CIFAR10 with Keras
Summary
Chapter 10: Autoencoder with TensorFlow and Keras
Autoencoder types
Stacked autoencoder in TensorFlow
Stacked autoencoder in Keras
Denoising autoencoder in TensorFlow
Denoising autoencoder in Keras
Variational autoencoder in TensorFlow
Variational autoencoder in Keras
Summary
Chapter 11: TensorFlow Models in Production with TF Serving
Saving and Restoring models in TensorFlow
Saving and restoring all graph variables with the saver class
Saving and restoring selected  variables with the saver class
Saving and restoring Keras models
TensorFlow Serving
Installing TF Serving
Saving models for TF Serving
Serving models with TF Serving
TF Serving in the Docker containers
Installing Docker
Building a Docker image for TF serving
Serving the model in the Docker container
TensorFlow Serving on Kubernetes
Installing Kubernetes
Uploading the Docker image to the dockerhub
Deploying in Kubernetes
Summary
Chapter 12: Transfer Learning and Pre-Trained Models
ImageNet dataset
Retraining or fine-tuning models
COCO animals dataset and pre-processing images
VGG16 in TensorFlow
Image classification using pre-trained VGG16 in TensorFlow
Image preprocessing in TensorFlow for pre-trained VGG16
Image classification using retrained  VGG16 in TensorFlow
VGG16 in Keras
Image classification using pre-trained VGG16 in Keras
Image classification using retrained VGG16 in Keras
Inception v3 in TensorFlow
Image classification using Inception v3 in TensorFlow
Image classification using retrained Inception v3 in TensorFlow
Summary
Chapter 13: Deep Reinforcement Learning
OpenAI Gym 101
Applying simple policies to a cartpole game
Reinforcement learning 101
Q function (learning to optimize when the model is not available)
Exploration and exploitation in the RL algorithms
V function (learning to optimize when the model is available)
Reinforcement learning techniques
Naive Neural Network policy for Reinforcement Learning
Implementing Q-Learning
Initializing and discretizing for Q-Learning
Q-Learning with Q-Table
Q-Learning with Q-Network  or Deep Q Network (DQN) 
Summary
Chapter 14: Generative Adversarial Networks
Generative Adversarial Networks 101
Best practices for building and training GANs
Simple GAN with TensorFlow
Simple GAN with Keras
Deep Convolutional GAN with TensorFlow and Keras
Summary
Chapter 15: Distributed Models with TensorFlow Clusters
Strategies for distributed execution
TensorFlow clusters
Defining cluster specification
Create the server instances
Define the parameter and operations across servers and devices
Define and train the graph for asynchronous updates
Define and train the graph for synchronous updates
Summary
Chapter 16: TensorFlow Models on Mobile and Embedded Platforms
TensorFlow on mobile platforms
TF Mobile in Android apps
TF Mobile demo on Android
TF Mobile in iOS apps
TF Mobile demo on iOS
TensorFlow Lite
TF Lite Demo on Android
TF Lite demo on iOS
Summary
Chapter 17: TensorFlow and Keras in R
Installing TensorFlow and Keras packages in R
TF core API in R
TF estimator API in R
Keras API in R
TensorBoard in R
The tfruns package in R
Summary
Chapter 18: Debugging TensorFlow Models
Fetching tensor values with tf.Session.run()
Printing tensor values with tf.Print()
Asserting on conditions with tf.Assert()
Debugging with the TensorFlow debugger (tfdbg)
Summary
Appendix: Tensor Processing Units
Other Books You May Enjoy
Index