O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Deep Learning with TensorFlow - Second Edition

Book Description

Delve into neural networks, implement deep learning algorithms, and explore layers of data abstraction with the help of TensorFlow.

About This Book
  • Learn how to implement advanced techniques in deep learning with Google's brainchild, TensorFlow
  • Explore deep neural networks and layers of data abstraction with the help of this comprehensive guide
  • Gain real-world contextualization through some deep learning problems concerning research and application
Who This Book Is For

The book is for people interested in machine learning and machine intelligence. A rudimentary level of programming in one language is assumed, as is a basic familiarity with computer science techniques and technologies, including a basic awareness of computer hardware and algorithms. Some competence in mathematics is needed to the level of elementary linear algebra and calculus.

What You Will Learn
  • Apply deep machine intelligence and GPU computing with TensorFlow
  • Access public datasets and use TensorFlow to load, process, and transform the data
  • Discover how to use the high-level TensorFlow API to build more powerful applications
  • Use deep learning for scalable object detection and mobile computing
  • Train machines quickly to learn from data by exploring reinforcement learning techniques
  • Explore active areas of deep learning research and applications
In Detail

Deep learning is a branch of machine learning algorithms based on learning multiple levels of abstraction. Neural networks, which are at the core of deep learning, are being used in predictive analytics, computer vision, natural language processing, time series forecasting, and to perform a myriad of other complex tasks.

This book is conceived for developers, data analysts, machine learning practitioners and deep learning enthusiasts who want to build powerful, robust, and accurate predictive models with the power of TensorFlow, combined with other open source Python libraries.

Throughout the book, you’ll learn how to develop deep learning applications for machine learning systems using Feedforward Neural Networks, Convolutional Neural Networks, Recurrent Neural Networks, Autoencoders, and Factorization Machines. Discover how to attain deep learning programming on GPU in a distributed way.

You'll come away with an in-depth knowledge of machine learning techniques and the skills to apply them to real-world projects.

Style and approach

This step-by-step guide explores common, and not so common, deep neural networks, and shows how they can be exploited in the real world with complex raw data. Benefit from practical examples, and learn how to implement different types of neural nets to build smart applications related to text, speech, and image data processing.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Deep Learning with TensorFlow - Second Edition
    1. Table of Contents
    2. Deep Learning with TensorFlow - Second Edition
      1. Why subscribe?
      2. PacktPub.com
    3. Contributors
      1. About the authors
      2. About the reviewers
      3. Packt is Searching for Authors Like You
    4. Preface
      1. Who this book is for
      2. What this book covers
      3. To get the most out of this book
        1. Download the example code files
        2. Download the color images
        3. Conventions used
      4. Get in touch
        1. Reviews
    5. 1. Getting Started with Deep Learning
      1. A soft introduction to machine learning
        1. Supervised learning
        2. Unbalanced data
        3. Unsupervised learning
        4. Reinforcement learning
        5. What is deep learning?
      2. Artificial neural networks
        1. The biological neurons
        2. The artificial neuron
      3. How does an ANN learn?
        1. ANNs and the backpropagation algorithm
        2. Weight optimization
        3. Stochastic gradient descent
      4. Neural network architectures
        1. Deep Neural Networks (DNNs)
          1. Multilayer perceptron
          2. Deep Belief Networks (DBNs)
        2. Convolutional Neural Networks (CNNs)
        3. AutoEncoders
        4. Recurrent Neural Networks (RNNs)
        5. Emergent architectures
      5. Deep learning frameworks
      6. Summary
    6. 2. A First Look at TensorFlow
      1. A general overview of TensorFlow
      2. What's new from TensorFlow v1.6 forwards?
        1. Nvidia GPU support optimized
        2. Introducing TensorFlow Lite
        3. Eager execution
        4. Optimized Accelerated Linear Algebra (XLA)
      3. Installing and configuring TensorFlow
      4. TensorFlow computational graph
      5. TensorFlow code structure
        1. Eager execution with TensorFlow
      6. Data model in TensorFlow
        1. Tensor
        2. Rank and shape
        3. Data type
        4. Variables
        5. Fetches
        6. Feeds and placeholders
      7. Visualizing computations through TensorBoard
        1. How does TensorBoard work?
      8. Linear regression and beyond
        1. Linear regression revisited for a real dataset
      9. Summary
    7. 3. Feed-Forward Neural Networks with TensorFlow
      1. Feed-forward neural networks (FFNNs)
        1. Feed-forward and backpropagation
        2. Weights and biases
        3. Activation functions
          1. Using sigmoid
          2. Using tanh
          3. Using ReLU
          4. Using softmax
      2. Implementing a feed-forward neural network
        1. Exploring the MNIST dataset
          1. Softmax classifier
      3. Implementing a multilayer perceptron (MLP)
        1. Training an MLP
        2. Using MLPs
          1. Dataset description
          2. Preprocessing
          3. A TensorFlow implementation of MLP for client-subscription assessment
        3. Deep Belief Networks (DBNs)
          1. Restricted Boltzmann Machines (RBMs)
          2. Construction of a simple DBN
          3. Unsupervised pre-training
          4. Supervised fine-tuning
        4. Implementing a DBN with TensorFlow for client-subscription assessment
      4. Tuning hyperparameters and advanced FFNNs
        1. Tuning FFNN hyperparameters
          1. Number of hidden layers
          2. Number of neurons per hidden layer
          3. Weight and biases initialization
          4. Selecting the most suitable optimizer
          5. GridSearch and randomized search for hyperparameters tuning
        2. Regularization
        3. Dropout optimization
      5. Summary
    8. 4. Convolutional Neural Networks
      1. Main concepts of CNNs
      2. CNNs in action
      3. LeNet5
      4. Implementing a LeNet-5 step by step
        1. AlexNet
        2. Transfer learning
        3. Pretrained AlexNet
      5. Dataset preparation
      6. Fine-tuning implementation
        1. VGG
        2. Artistic style learning with VGG-19
        3. Input images
        4. Content extractor and loss
        5. Style extractor and loss
        6. Merger and total loss
        7. Training
      7. Inception-v3
        1. Exploring Inception with TensorFlow
      8. Emotion recognition with CNNs
        1. Testing the model on your own image
        2. Source code
      9. Summary
    9. 5. Optimizing TensorFlow Autoencoders
      1. How does an autoencoder work?
      2. Implementing autoencoders with TensorFlow
      3. Improving autoencoder robustness
        1. Implementing a denoising autoencoder
        2. Implementing a convolutional autoencoder
          1. Encoder
          2. Decoder
      4. Fraud analytics with autoencoders
        1. Description of the dataset
        2. Problem description
        3. Exploratory data analysis
        4. Training, validation, and testing set preparation
        5. Normalization
        6. Autoencoder as an unsupervised feature learning algorithm
        7. Evaluating the model
      5. Summary
    10. 6. Recurrent Neural Networks
      1. Working principles of RNNs
        1. Implementing basic RNNs in TensorFlow
        2. RNN and the long-term dependency problem
          1. Bi-directional RNNs
      2. RNN and the gradient vanishing-exploding problem
        1. LSTM networks
        2. GRU cell
      3. Implementing an RNN for spam prediction
        1. Data description and preprocessing
      4. Developing a predictive model for time series data
        1. Description of the dataset
        2. Pre-processing and exploratory analysis
        3. LSTM predictive model
        4. Model evaluation
      5. An LSTM predictive model for sentiment analysis
        1. Network design
        2. LSTM model training
        3. Visualizing through TensorBoard
        4. LSTM model evaluation
      6. Human activity recognition using LSTM model
        1. Dataset description
        2. Workflow of the LSTM model for HAR
        3. Implementing an LSTM model for HAR
      7. Summary
    11. 7. Heterogeneous and Distributed Computing
      1. GPGPU computing
        1. The GPGPU history
        2. The CUDA architecture
        3. The GPU programming model
      2. The TensorFlow GPU setup
        1. Update TensorFlow
        2. GPU representation
        3. Using a GPU
        4. GPU memory management
        5. Assigning a single GPU on a multi-GPU system
        6. The source code for GPU with soft placement
        7. Using multiple GPUs
      3. Distributed computing
        1. Model parallelism
        2. Data parallelism
      4. The distributed TensorFlow setup
      5. Summary
    12. 8. Advanced TensorFlow Programming
      1. tf.estimator
        1. Estimators
        2. Graph actions
        3. Parsing resources
        4. Flower predictions
      2. TFLearn
        1. Installation
        2. Titanic survival predictor
      3. PrettyTensor
        1. Chaining layers
        2. Normal mode
        3. Sequential mode
        4. Branch and join
        5. Digit classifier
      4. Keras
        1. Keras programming models
          1. Sequential model
            1. Sentiment classification of movie reviews
          2. Functional API
            1. SqueezeNet
      5. Summary
    13. 9. Recommendation Systems Using Factorization Machines
      1. Recommendation systems
        1. Collaborative filtering approaches
        2. Content-based filtering approaches
        3. Hybrid recommender systems
        4. Model-based collaborative filtering
      2. Movie recommendation using collaborative filtering
        1. The utility matrix
        2. Description of the dataset
          1. Ratings data
          2. Movies data
          3. Users data
        3. Exploratory analysis of the MovieLens dataset
        4. Implementing a movie RE
          1. Training the model with the available ratings
          2. Inferencing the saved model
          3. Generating the user-item table
          4. Clustering similar movies
          5. Movie rating prediction by users
          6. Finding top k movies
          7. Predicting top k similar movies
          8. Computing user-user similarity
        5. Evaluating the recommender system
      3. Factorization machines for recommendation systems
        1. Factorization machines
          1. Cold-start problem and collaborative-filtering approaches
        2. Problem definition and formulation
        3. Dataset description
          1. Workflow of the implementation
        4. Preprocessing
          1. Training the FM model
      4. Improved factorization machines
        1. Neural factorization machines
          1. Dataset description
          2. Using NFM for the movie recommendation
            1. Model training
            2. Model evaluation
      5. Summary
    14. 10. Reinforcement Learning
      1. The RL problem
      2. OpenAI Gym
        1. OpenAI environments
        2. The env class
        3. Installing and running OpenAI Gym
      3. The Q-Learning algorithm
        1. The FrozenLake environment
      4. Deep Q-learning
        1. Deep Q neural networks
        2. The Cart-Pole problem
          1. Deep Q-Network for the Cart-Pole problem
          2. The Experience Replay method
          3. Exploitation and exploration
          4. The Deep Q-Learning training algorithm
      5. Summary
    15. Other Books You May Enjoy
      1. Leave a review – let other readers know what you think
    16. Index