TensorFlow 1.x Deep Learning Cookbook

Book description

Take the next step in implementing various common and not-so-common neural networks with Tensorflow 1.x

About This Book

  • Skill up and implement tricky neural networks using Google's TensorFlow 1.x
  • An easy-to-follow guide that lets you explore reinforcement learning, GANs, autoencoders, multilayer perceptrons and more.
  • Hands-on recipes to work with Tensorflow on desktop, mobile, and cloud environment

Who This Book Is For

This book is intended for data analysts, data scientists, machine learning practitioners and deep learning enthusiasts who want to perform deep learning tasks on a regular basis and are looking for a handy guide they can refer to. People who are slightly familiar with neural networks, and now want to gain expertise in working with different types of neural networks and datasets, will find this book quite useful.

What You Will Learn

  • Install TensorFlow and use it for CPU and GPU operations
  • Implement DNNs and apply them to solve different AI-driven problems.
  • Leverage different data sets such as MNIST, CIFAR-10, and Youtube8m with TensorFlow and learn how to access and use them in your code.
  • Use TensorBoard to understand neural network architectures, optimize the learning process, and peek inside the neural network black box.
  • Use different regression techniques for prediction and classification problems
  • Build single and multilayer perceptrons in TensorFlow
  • Implement CNN and RNN in TensorFlow, and use it to solve real-world use cases.
  • Learn how restricted Boltzmann Machines can be used to recommend movies.
  • Understand the implementation of Autoencoders and deep belief networks, and use them for emotion detection.
  • Master the different reinforcement learning methods to implement game playing agents.
  • GANs and their implementation using TensorFlow.

In Detail

Deep neural networks (DNNs) have achieved a lot of success in the field of computer vision, speech recognition, and natural language processing. The entire world is filled with excitement about how deep networks are revolutionizing artificial intelligence. This exciting recipe-based guide will take you from the realm of DNN theory to implementing them practically to solve the real-life problems in artificial intelligence domain.

In this book, you will learn how to efficiently use TensorFlow, Google's open source framework for deep learning. You will implement different deep learning networks such as Convolutional Neural Networks (CNNs), Recurrent Neural Networks (RNNs), Deep Q-learning Networks (DQNs), and Generative Adversarial Networks (GANs) with easy to follow independent recipes. You will learn how to make Keras as backend with TensorFlow.

With a problem-solution approach, you will understand how to implement different deep neural architectures to carry out complex tasks at work. You will learn the performance of different DNNs on some popularly used data sets such as MNIST, CIFAR-10, Youtube8m, and more. You will not only learn about the different mobile and embedded platforms supported by TensorFlow but also how to set up cloud platforms for deep learning applications. Get a sneak peek of TPU architecture and how they will affect DNN future.

By using crisp, no-nonsense recipes, you will become an expert in implementing deep learning techniques in growing real-world applications and research areas such as reinforcement learning, GANs, autoencoders and more.

Style and approach

This book consists of hands-on recipes where you'll deal with real-world problems.

You'll execute a series of tasks as you walk through data mining challenges using TensorFlow 1.x.

Your one-stop solution for common and not-so-common pain points, this is a book that you must have on the shelf.

Publisher resources

Download Example Code

Table of contents

  1. Preface
    1. What this book covers
    2. What you need for this book
    3. Who this book is for
    4. Sections
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
      5. See also
    5. Conventions
    6. Reader feedback
    7. Customer support
      1. Downloading the example code
      2. Errata
      3. Piracy
      4. Questions
  2. TensorFlow - An Introduction
    1. Introduction
    2. Installing TensorFlow
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    3. Hello world in TensorFlow
      1. How to do it...
      2. How it works...
    4. Understanding the TensorFlow program structure
      1. How to do it...
      2. How it works...
      3. There's more...
    5. Working with constants, variables, and placeholders
      1. How to do it...
      2. How it works...
      3. There's more...
    6. Performing matrix manipulations using TensorFlow
      1. How to do it...
      2. How it works...
      3. There's more...
    7. Using a data flow graph
      1. How to do it...
    8. Migrating from 0.x to 1.x
      1. How to do it...
      2. There's more...
    9. Using XLA to enhance computational performance
      1. Getting ready
      2. How to do it...
    10. Invoking CPU/GPU devices
      1. How to do it...
      2. How it works...
    11. TensorFlow for Deep Learning
      1. How to do it...
      2. There's more
    12. Different Python packages required for DNN-based problems
      1. How to do it...
      2. See also
  3. Regression
    1. Introduction
    2. Choosing loss functions
      1. Getting ready
      2.  How to do it...
      3. How it works...
      4. There's more...
    3. Optimizers in TensorFlow
      1. Getting ready
      2. How to do it...
      3. There's more...
      4. See also
    4. Reading from CSV files and preprocessing data
      1. Getting ready
      2. How to do it…
      3. There's more...
    5. House price estimation-simple linear regression
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    6. House price estimation-multiple linear regression
      1. How to do it...
      2. How it works...
      3. There's more...
    7. Logistic regression on the MNIST dataset
      1. How to do it...
      2. How it works...
      3. See also
  4. Neural Networks - Perceptron
    1. Introduction
    2. Activation functions
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    3. Single layer perceptron
      1. Getting ready
      2. How to do it...
      3. There's more...
    4. Calculating gradients of backpropagation algorithm 
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    5. MNIST classifier using MLP
      1. Getting ready
      2. How to do it...
      3. How it works...
    6. Function approximation using MLP-predicting Boston house prices
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    7. Tuning hyperparameters
      1. How to do it...
      2. There's more...
      3. See also
    8. Higher-level APIs-Keras
      1. How to do it...
      2. There's more...
    9. See also
  5. Convolutional Neural Networks
    1. Introduction
      1. Local receptive fields
      2. Shared weights and bias
      3. A mathematical example
      4. ConvNets in TensorFlow
      5. Pooling layers
      6. Max pooling
      7. Average pooling
      8. ConvNets summary
    2. Creating a ConvNet to classify handwritten MNIST numbers
      1. Getting ready
      2. How to do it...
      3. How it works...
    3. Creating a ConvNet to classify CIFAR-10
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    4. Transferring style with VGG19 for image repainting
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    5. Using a pretrained VGG16 net for transfer learning
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    6. Creating a DeepDream network
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
  6. Advanced Convolutional Neural Networks
    1. Introduction
    2. Creating a ConvNet for Sentiment Analysis
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There is more...
    3. Inspecting what filters a VGG pre-built network has learned
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There is more...
    4. Classifying images with VGGNet, ResNet, Inception, and Xception
      1. VGG16 and VGG19
      2. ResNet
      3. Inception
      4. Xception
      5. Getting ready
      6. How to do it...
      7. How it works...
      8. There is more...
    5. Recycling pre-built Deep Learning models for extracting features
      1. Getting ready
      2. How to do it...
      3. How it works...
    6. Very deep InceptionV3 Net used for Transfer Learning
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There is more...
    7. Generating music with dilated ConvNets, WaveNet, and NSynth
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There is more...
    8. Answering questions about images (Visual Q&A)
      1. How to do it...
      2. How it works...
      3. There is more...
    9. Classifying videos with pre-trained nets in six different ways
      1. How to do it...
      2. How it works...
      3. There is more...
  7. Recurrent Neural Networks
    1. Introduction
      1. Vanishing and exploding gradients
      2. Long Short Term Memory (LSTM)
      3. Gated Recurrent Units (GRUs) and Peephole LSTM
      4. Operating on sequences of vectors
    2. Neural machine translation - training a seq2seq RNN
      1. Getting ready
      2. How to do it...
      3. How it works...
    3. Neural machine translation - inference on a seq2seq RNN
      1. How to do it...
      2. How it works...
    4. All you need is attention - another example of a seq2seq RNN
      1. How to do it...
      2. How it works...
      3. There's more...
    5. Learning to write as Shakespeare with RNNs
      1. How to do it...
      2. How it works...
        1. First iteration
        2. After a few iterations
      3. There's more...
    6. Learning to predict future Bitcoin value with RNNs
      1. How to do it...
      2. How it works...
      3. There's more...
    7. Many-to-one and many-to-many RNN examples
      1. How to do it...
      2. How it works...
  8. Unsupervised Learning
    1. Introduction
    2. Principal component analysis
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    3. k-means clustering
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Self-organizing maps
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
    5. Restricted Boltzmann Machine
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
    6. Recommender system using RBM
      1. Getting ready
      2. How to do it...
      3. There's more...
    7. DBN for Emotion Detection
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
  9. Autoencoders
    1. Introduction
      1. See Also
    2. Vanilla autoencoders
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    3. Sparse autoencoder
      1. Getting Ready...
      2. How to do it...
      3. How it works...
      4. There's More...
      5. See Also
    4. Denoising autoencoder
      1. Getting Ready
      2. How to do it...
      3. See Also
    5. Convolutional autoencoders
      1. Getting Ready...
      2. How to do it...
      3. How it Works...
      4. There's More...
      5. See Also
    6. Stacked autoencoder
      1. Getting Ready
      2. How to do it...
      3. How it works...
      4. There's More...
      5. See Also
  10. Reinforcement Learning
    1. Introduction
    2. Learning OpenAI Gym
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    3. Implementing neural network agent to play Pac-Man
      1. Getting ready
      2. How to do it...
    4. Q learning to balance Cart-Pole
      1. Getting ready
      2. How to do it...
      3. There's more...
      4. See also
    5. Game of Atari using Deep Q Networks
      1. Getting ready
      2. How to do it...
      3. There's more...
      4. See also
    6. Policy gradients to play the game of Pong
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
        1. AlphaGo Zero
      5. See also
  11. Mobile Computation
    1. Introduction
      1. TensorFlow, mobile, and the cloud
    2. Installing TensorFlow mobile for macOS and Android
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    3. Playing with TensorFlow and Android examples
      1. Getting ready
      2. How to do it...
      3. How it works...
    4. Installing TensorFlow mobile for macOS and iPhone
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    5. Optimizing a TensorFlow graph for mobile devices
      1. Getting ready
      2. How to do it...
      3. How it works...
    6. Profiling a TensorFlow graph for mobile devices
      1. Getting ready
      2. How to do it...
      3. How it works...
    7. Transforming a TensorFlow graph for mobile devices
      1. Getting ready
      2. How to do it...
      3. How it works...
  12. Generative Models and CapsNet
    1. Introduction
      1. So what is a GAN?
      2. Some cool GAN applications
    2. Learning to forge MNIST images with simple GANs
      1. Getting ready
      2. How to do it...
      3. How it works...
    3. Learning to forge MNIST images with DCGANs
      1. Getting ready
      2. How to do it...
      3. How it works...
    4. Learning to forge Celebrity Faces and other datasets with DCGAN
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    5. Implementing Variational Autoencoders
      1. Getting ready...
      2. How to do it...
      3. How it works...
      4. There's More...
      5. See also...
    6. Learning to beat the previous MNIST state-of-the-art results with Capsule Networks
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
  13. Distributed TensorFlow and Cloud Deep Learning
    1. Introduction
    2. Working with TensorFlow and GPUs
      1. Getting ready
      2. How to do it...
      3. How it works...
    3. Playing with Distributed TensorFlow: multiple GPUs and one CPU
      1. Getting ready
      2. How to do it...
      3. How it works...
    4. Playing with Distributed TensorFlow: multiple servers
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There is more...
    5. Training a Distributed TensorFlow MNIST classifier
      1. Getting ready
      2. How to do it...
      3. How it works...
    6. Working with TensorFlow Serving and Docker
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There is more...
    7. Running Distributed TensorFlow on Google Cloud (GCP) with Compute Engine
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There is more...
    8. Running Distributed TensorFlow on Google CloudML
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There is more...
    9. Running Distributed TensorFlow on Microsoft Azure
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    10. Running Distributed TensorFlow on Amazon AWS
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There is more...
  14. Learning to Learn with AutoML (Meta-Learning)
    1. Meta-learning with recurrent networks and with reinforcement learning
    2. Meta-learning blocks
    3. Meta-learning novel tasks
    4. Siamese Network
      1. Applications of Siamese Networks
      2. A working example - MNIST
  15. TensorFlow Processing Units
    1. Components of TPUs
      1. Advantages of TPUs
      2. Accessing TPUs
      3. Resources on TPUs

Product information

  • Title: TensorFlow 1.x Deep Learning Cookbook
  • Author(s): Antonio Gulli, Amita Kapoor
  • Release date: December 2017
  • Publisher(s): Packt Publishing
  • ISBN: 9781788293594