The TensorFlow Workshop

Book description

Get started with TensorFlow fundamentals to build and train deep learning models with real-world data, practical exercises, and challenging activities

Key Features

  • Understand the fundamentals of tensors, neural networks, and deep learning
  • Discover how to implement and fine-tune deep learning models for real-world datasets
  • Build your experience and confidence with hands-on exercises and activities

Book Description

Getting to grips with tensors, deep learning, and neural networks can be intimidating and confusing for anyone, no matter their experience level. The breadth of information out there, often written at a very high level and aimed at advanced practitioners, can make getting started even more challenging.

If this sounds familiar to you, The TensorFlow Workshop is here to help. Combining clear explanations, realistic examples, and plenty of hands-on practice, it'll quickly get you up and running.

You'll start off with the basics - learning how to load data into TensorFlow, perform tensor operations, and utilize common optimizers and activation functions. As you progress, you'll experiment with different TensorFlow development tools, including TensorBoard, TensorFlow Hub, and Google Colab, before moving on to solve regression and classification problems with sequential models.

Building on this solid foundation, you'll learn how to tune models and work with different types of neural network, getting hands-on with real-world deep learning applications such as text encoding, temperature forecasting, image augmentation, and audio processing.

By the end of this deep learning book, you'll have the skills, knowledge, and confidence to tackle your own ambitious deep learning projects with TensorFlow.

What you will learn

  • Get to grips with TensorFlow's mathematical operations
  • Pre-process a wide variety of tabular, sequential, and image data
  • Understand the purpose and usage of different deep learning layers
  • Perform hyperparameter-tuning to prevent overfitting of training data
  • Use pre-trained models to speed up the development of learning models
  • Generate new data based on existing patterns using generative models

Who this book is for

This TensorFlow book is for anyone who wants to develop their understanding of deep learning and get started building neural networks with TensorFlow. Basic knowledge of Python programming and its libraries, as well as a general understanding of the fundamentals of data science and machine learning, will help you grasp the topics covered in this book more easily.

Table of contents

  1. The TensorFlow Workshop
  2. Preface
    1. About the Book
      1. About the Authors
      2. Who This Book Is For
      3. About the Chapters
      4. Conventions
      5. Code Presentation
      6. Minimum Hardware Requirements
      7. Downloading the Code Bundle
      8. Setting Up Your Environment
        1. Installing Anaconda on Your System
        2. Launching Jupyter Notebook
        3. Installing the tensorflow Virtual Environment
      9. Get in Touch
      10. Please Leave a Review
  3. 1. Introduction to Machine Learning with TensorFlow
    1. Introduction
    2. Implementing Artificial Neural Networks in TensorFlow
      1. Advantages of TensorFlow
      2. Disadvantages of TensorFlow
    3. The TensorFlow Library in Python
      1. Exercise 1.01: Verifying Your Version of TensorFlow
    4. Introduction to Tensors
      1. Scalars, Vectors, Matrices, and Tensors
      2. Exercise 1.02: Creating Scalars, Vectors, Matrices, and Tensors in TensorFlow
    5. Tensor Addition
      1. Exercise 1.03: Performing Tensor Addition in TensorFlow
      2. Activity 1.01: Performing Tensor Addition in TensorFlow
    6. Reshaping
      1. Tensor Transposition
      2. Exercise 1.04: Performing Tensor Reshaping and Transposition in TensorFlow
      3. Activity 1.02: Performing Tensor Reshaping and Transposition in TensorFlow
    7. Tensor Multiplication
      1. Exercise 1.05: Performing Tensor Multiplication in TensorFlow
    8. Optimization
      1. Forward Propagation
      2. Backpropagation
      3. Learning Optimal Parameters
      4. Optimizers in TensorFlow
    9. Activation functions
      1. Activity 1.03: Applying Activation Functions
    10. Summary
  4. 2. Loading and Processing Data
    1. Introduction
    2. Exploring Data Types
    3. Data Preprocessing
    4. Processing Tabular Data
      1. Exercise 2.01: Loading Tabular Data and Rescaling Numerical Fields
      2. Activity 2.01: Loading Tabular Data and Rescaling Numerical Fields with a MinMax Scaler
      3. Exercise 2.02: Preprocessing Non-Numerical Data
    5. Processing Image Data
      1. Exercise 2.03: Loading Image Data for Batch Processing
    6. Image Augmentation
      1. Activity 2.02: Loading Image Data for Batch Processing
    7. Text Processing
      1. Exercise 2.04: Loading Text Data for TensorFlow Models
    8. Audio Processing
      1. Exercise 2.05: Loading Audio Data for TensorFlow Models
      2. Activity 2.03: Loading Audio Data for Batch Processing
    9. Summary
  5. 3. TensorFlow Development
    1. Introduction
    2. TensorBoard
      1. Exercise 3.01: Using TensorBoard to Visualize Matrix Multiplication
      2. Activity 3.01: Using TensorBoard to Visualize Tensor Transformations
      3. Exercise 3.02: Using TensorBoard to Visualize Image Batches
    3. TensorFlow Hub
      1. Exercise 3.03: Downloading a Model from TensorFlow Hub
    4. Google Colab
      1. Advantages of Google Colab
      2. Disadvantages of Google Colab
      3. Development on Google Colab
      4. Exercise 3.04: Using Google Colab to Visualize Data
      5. Activity 3.02: Performing Word Embedding from a Pre-Trained Model from TensorFlow Hub
    5. Summary
  6. 4. Regression and Classification Models
    1. Introduction
    2. Sequential Models
      1. Keras Layers
      2. Exercise 4.01: Creating an ANN with TensorFlow
    3. Model Fitting
      1. The Loss Function
      2. Model Evaluation
      3. Exercise 4.02: Creating a Linear Regression Model as an ANN with TensorFlow
      4. Exercise 4.03: Creating a Multi-Layer ANN with TensorFlow
      5. Activity 4.01: Creating a Multi-Layer ANN with TensorFlow
    4. Classification Models
      1. Exercise 4.04: Creating a Logistic Regression Model as an ANN with TensorFlow
      2. Activity 4.02: Creating a Multi-Layer Classification ANN with TensorFlow
    5. Summary
  7. 5. Classification Models
    1. Introduction
    2. Binary Classification
      1. Logistic Regression
      2. Binary Cross-Entropy
      3. Binary Classification Architecture
      4. Exercise 5.01: Building a Logistic Regression Model
    3. Metrics for Classifiers
      1. Accuracy and Null Accuracy
      2. Precision, Recall, and the F1 Score
      3. Confusion Matrices
      4. Exercise 5.02: Classification Evaluation Metrics
    4. Multi-Class Classification
      1. The Softmax Function
      2. Categorical Cross-Entropy
      3. Multi-Class Classification Architecture
      4. Exercise 5.03: Building a Multi-Class Model
      5. Activity 5.01: Building a Character Recognition Model with TensorFlow
    5. Multi-Label Classification
      1. Activity 5.02: Building a Movie Genre Tagging a Model with TensorFlow
    6. Summary
  8. 6. Regularization and Hyperparameter Tuning
    1. Introduction
    2. Regularization Techniques
      1. L1 Regularization
      2. L2 Regularization
      3. Exercise 6.01: Predicting a Connect-4 Game Outcome Using the L2 Regularizer
      4. Dropout Regularization
      5. Exercise 6.02: Predicting a Connect-4 Game Outcome Using Dropout
      6. Early Stopping
      7. Activity 6.01: Predicting Income with L1 and L2 Regularizers
    3. Hyperparameter Tuning
      1. Keras Tuner
      2. Random Search
      3. Exercise 6.03: Predicting a Connect-4 Game Outcome Using Random Search from Keras Tuner
      4. Hyperband
      5. Exercise 6.04: Predicting a Connect-4 Game Outcome Using Hyperband from Keras Tuner
      6. Bayesian Optimization
      7. Activity 6.02: Predicting Income with Bayesian Optimization from Keras Tuner
    4. Summary
  9. 7. Convolutional Neural Networks
    1. Introduction
    2. CNNs
    3. Image Representation
    4. The Convolutional Layer
      1. Creating the Model
      2. Exercise 7.01: Creating the First Layer to Build a CNN
    5. Pooling Layer
      1. Max Pooling
      2. Average Pooling
      3. Exercise 7.02: Creating a Pooling Layer for a CNN
      4. Flattening Layer
      5. Exercise 7.03: Building a CNN
    6. Image Augmentation
      1. Batch Normalization
      2. Exercise 7.04: Building a CNN with Additional Convolutional Layers
    7. Binary Image Classification
    8. Object Classification
      1. Exercise 7.05: Building a CNN
      2. Activity 7.01: Building a CNN with More ANN Layers
    9. Summary
  10. 8. Pre-Trained Networks
    1. Introduction
    2. ImageNet
    3. Transfer Learning
      1. Exercise 8.01: Classifying Cats and Dogs with Transfer Learning
    4. Fine-Tuning
      1. Activity 8.01: Fruit Classification with Fine-Tuning
    5. TensorFlow Hub
    6. Feature Extraction
      1. Activity 8.02: Transfer Learning with TensorFlow Hub
    7. Summary
  11. 9. Recurrent Neural Networks
    1. Introduction
    2. Sequential Data
      1. Examples of Sequential Data
      2. Exercise 9.01: Training an ANN for Sequential Data – Nvidia Stock Prediction
    3. Recurrent Neural Networks
      1. RNN Architecture
      2. Vanishing Gradient Problem
      3. Long Short-Term Memory Network
      4. Exercise 9.02: Building an RNN with an LSTM Layer – Nvidia Stock Prediction
      5. Activity 9.01: Building an RNN with Multiple LSTM Layers to Predict Power Consumption
    4. Natural Language Processing
      1. Data Preprocessing
        1. Dataset Cleaning
        2. Generating a Sequence and Tokenization
        3. Padding Sequences
    5. Back Propagation Through Time (BPTT)
      1. Exercise 9.03: Building an RNN with an LSTM Layer for Natural Language Processing
      2. Activity 9.02: Building an RNN for Predicting Tweets' Sentiment
    6. Summary
  12. 10. Custom TensorFlow Components
    1. Introduction
    2. TensorFlow APIs
    3. Implementing Custom Loss Functions
      1. Building a Custom Loss Function with the Functional API
      2. Building a Custom Loss Function with the Subclassing API
      3. Exercise 10.01: Building a Custom Loss Function
    4. Implementing Custom Layers
      1. Introduction to ResNet Blocks
      2. Building Custom Layers with the Functional API
      3. Building Custom Layers with Subclassing
      4. Exercise 10.02: Building a Custom Layer
      5. Activity 10.01: Building a Model with Custom Layers and a Custom Loss Function
    5. Summary
  13. 11. Generative Models
    1. Introduction
    2. Text Generation
      1. Extending NLP Sequence Models to Generate Text
      2. Dataset Cleaning
      3. Generating a Sequence and Tokenization
      4. Generating a Sequence of n-gram Tokens
      5. Padding Sequences
      6. Exercise 11.01: Generating Text
    3. Generative Adversarial Networks
      1. The Generator Network
      2. The Discriminator Network
      3. The Adversarial Network
        1. Combining the Generative and Discriminative Models
        2. Generating Real Samples with Class Labels
        3. Creating Latent Points for the Generator
        4. Using the Generator to Generate Fake Samples and Class Labels
        5. Evaluating the Discriminator Model
        6. Training the Generator and Discriminator
        7. Creating the Latent Space, Generator, Discriminator, GAN, and Training Data
      4. Exercise 11.02: Generating Sequences with GANs
    4. Deep Convolutional Generative Adversarial Networks (DCGANs)
      1. Training a DCGAN
      2. Exercise 11.03: Generating Images with DCGAN
      3. Activity 11.01: Generating Images Using GANs
    5. Summary
  14. Appendix
    1. 1. Introduction to Machine Learning with TensorFlow
      1. Activity 1.01: Performing Tensor Addition in TensorFlow
      2. Activity 1.02: Performing Tensor Reshaping and Transposition in TensorFlow
      3. Activity 1.03: Applying Activation Functions
    2. 2. Loading and Processing Data
      1. Activity 2.01: Loading Tabular Data and Rescaling Numerical Fields with a MinMax Scaler
      2. Activity 2.02: Loading Image Data for Batch Processing
      3. Activity 2.03: Loading Audio Data for Batch Processing
    3. 3. TensorFlow Development
      1. Activity 3.01: Using TensorBoard to Visualize Tensor Transformations
      2. Activity 3.02: Performing Word Embedding from a Pre-Trained Model from TensorFlow Hub
    4. 4. Regression and Classification Models
      1. Activity 4.01: Creating a Multi-Layer ANN with TensorFlow
      2. Activity 4.02: Creating a Multi-Layer Classification ANN with TensorFlow
    5. 5. Classification Models
      1. Activity 5.01: Building a Character Recognition Model with TensorFlow
      2. Activity 5.02: Building a Movie Genre Tagging a Model with TensorFlow
    6. 6. Regularization and Hyperparameter Tuning
      1. Activity 6.01: Predicting Income with L1 and L2 Regularizers
      2. Activity 6.02: Predicting Income with Bayesian Optimization from Keras Tuner
    7. 7. Convolutional Neural Networks
      1. Activity 7.01: Building a CNN with More ANN Layers
    8. 8. Pre-Trained Networks
      1. Activity 8.01: Fruit Classification with Fine-Tuning
      2. Activity 8.02: Transfer Learning with TensorFlow Hub
    9. 9. Recurrent Neural Networks
      1. Activity 9.01: Building an RNN with Multiple LSTM Layers to Predict Power Consumption
      2. Activity 9.02: Building an RNN for Predicting Tweets' Sentiment
    10. 10. Custom TensorFlow Components
      1. Activity 10.01: Building a Model with Custom Layers and a Custom Loss Function
    11. 11. Generative Models
      1. Activity 11.01: Generating Images Using GANs
      2. Hey!

Product information

  • Title: The TensorFlow Workshop
  • Author(s): Matthew Moocarme, Anthony So, Anthony Maddalone
  • Release date: December 2021
  • Publisher(s): Packt Publishing
  • ISBN: 9781800205253