Hands-On Deep Learning with Go

Book description

Apply modern deep learning techniques to build and train deep neural networks using Gorgonia

Key Features

  • Gain a practical understanding of deep learning using Golang
  • Build complex neural network models using Go libraries and Gorgonia
  • Take your deep learning model from design to deployment with this handy guide

Book Description

Go is an open source programming language designed by Google for handling large-scale projects efficiently. The Go ecosystem comprises some really powerful deep learning tools such as DQN and CUDA. With this book, you'll be able to use these tools to train and deploy scalable deep learning models from scratch.

This deep learning book begins by introducing you to a variety of tools and libraries available in Go. It then takes you through building neural networks, including activation functions and the learning algorithms that make neural networks tick. In addition to this, you'll learn how to build advanced architectures such as autoencoders, restricted Boltzmann machines (RBMs), convolutional neural networks (CNNs), recurrent neural networks (RNNs), and more. You'll also understand how you can scale model deployments on the AWS cloud infrastructure for training and inference.

By the end of this book, you'll have mastered the art of building, training, and deploying deep learning models in Go to solve real-world problems.

What you will learn

  • Explore the Go ecosystem of libraries and communities for deep learning
  • Get to grips with Neural Networks, their history, and how they work
  • Design and implement Deep Neural Networks in Go
  • Get a strong foundation of concepts such as Backpropagation and Momentum
  • Build Variational Autoencoders and Restricted Boltzmann Machines using Go
  • Build models with CUDA and benchmark CPU and GPU models

Who this book is for

This book is for data scientists, machine learning engineers, and AI developers who want to build state-of-the-art deep learning models using Go. Familiarity with basic machine learning concepts and Go programming is required to get the best out of this book.

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Hands-On Deep Learning with Go
  3. About Packt
    1. Why subscribe?
  4. Contributors
    1. About the authors
    2. About the reviewer
    3. Packt is searching for authors like you
  5. 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
  6. Section 1: Deep Learning in Go, Neural Networks, and How to Train Them
  7. Introduction to Deep Learning in Go
    1. Introducing DL
      1. Why DL?
      2. DL – a history
      3. DL – hype or breakthrough?
      4. Defining deep learning
    2. Overview of ML in Go
      1. ML libraries
        1. Word-embeddings in Go
        2. Naive Bayesian classification and genetic algorithms for Go or Golang
        3. ML for Go
        4. Machine learning libraries for Golang
        5. GoBrain
        6. A set of numeric libraries for the Go programming language
    3. Using Gorgonia
      1. The basics of Gorgonia
      2. Simple example – addition
      3. Vectors and matrices
      4. Visualizing the graph
      5. Building more complex expressions
    4. Summary
  8. What Is a Neural Network and How Do I Train One?
    1. A basic neural network
      1. The structure of a neural network
      2. Your first neural network
    2. Activation functions
      1. Step functions
      2. Linear functions
      3. Rectified Linear Units
      4. Leaky ReLU
      5. Sigmoid functions
      6. Tanh
      7. But which one should we use?
    3. Gradient descent and backpropagation
      1. Gradient descent
      2. Backpropagation
      3. Stochastic gradient descent
    4. Advanced gradient descent algorithms
      1. Momentum
      2. Nesterov momentum
      3. RMSprop
    5. Summary
  9. Beyond Basic Neural Networks - Autoencoders and RBMs
    1. Loading data – MNIST
      1. What is MNIST?
      2. Loading MNIST
    2. Building a neural network for handwriting recognition
      1. Introduction to the model structure
        1. Layers
      2. Training
        1. Loss functions
        2. Epochs, iterations, and batch sizes
      3. Testing and validation
      4. Taking a closer look
      5. Exercises
    3. Building an autoencoder – generating MNIST digits
      1. Layers
      2. Training
        1. Loss function
        2. Input and output
        3. Epochs, iterations, and batch sizes
      3. Test and validation
    4. Building an RBM for Netflix-style collaborative filtering
      1. Introduction to RBMs
      2. RBMs for collaborative filtering
      3. Preparing our data – GroupLens movie ratings
      4. Building an RBM in Gorgonia
    5. Summary
    6. Further reading
  10. CUDA - GPU-Accelerated Training
    1. CPUs versus GPUs
      1. Computational workloads and chip design
      2. Memory access in GPUs
      3. Real-world performance
        1. Intel Xeon Phi CPU
        2. NVIDIA Maxwell GPU
    2. Understanding Gorgonia and CUDA
      1. CUDA
        1. Basic Linear Algebra Subprograms
      2. CUDA in Gorgonia
    3. Building a model in Gorgonia with CUDA support
      1. Installing CUDA support for Gorgonia
        1. Linux
        2. Windows
    4. Performance benchmarking of CPU versus GPU models for training and inference
      1. How to use CUDA
        1. CPU results
        2. GPU results
    5. Summary
  11. Section 2: Implementing Deep Neural Network Architectures
  12. Next Word Prediction with Recurrent Neural Networks
    1. Vanilla RNNs
    2. Training RNNs
      1. Backpropagation through time
      2. Cost function
    3. RNNs and vanishing gradients
    4. Augmenting your RNN with GRU/LSTM units
      1. Long Short-Term Memory units
      2. Gated Recurrent Units
      3. Bias initialization of gates
    5. Building an LSTM in Gorgonia
      1. Representing text data
      2. Importing and processing input
    6. Summary
      1. Further reading
  13. Object Recognition with Convolutional Neural Networks
    1. Introduction to CNNs
      1. What is a CNN?
        1. Normal feedforward versus ConvNet
        2. Layers
          1. Convolutional layer
          2. Pooling layer
        3. Basic structure
    2. Building an example CNN
      1. CIFAR-10
      2. Epochs and batch size
      3. Accuracy
      4. Constructing the layers
      5. Loss function and solver
      6. Test set output
    3. Assessing the results
      1. GPU acceleration
      2. CNN weaknesses
    4. Summary
    5. Further reading
  14. Maze Solving with Deep Q-Networks
    1. What is a DQN?
      1. Q-learning
      2. Optimization and network architecture
      3. Remember, act, and replay!
    2. Solving a maze using a DQN in Gorgonia
    3. Summary
    4. Further reading
  15. Generative Models with Variational Autoencoders
    1. Introduction to VAEs
    2. Building a VAE on MNIST
      1. Encoding
      2. Sampling
      3. Decoding
      4. Loss or cost function
    3. Assessing the results
      1. Changing the latent dimensions
    4. Summary
    5. Further reading
  16. Section 3: Pipeline, Deployment, and Beyond!
  17. Building a Deep Learning Pipeline
    1. Exploring Pachyderm
      1. Installing and configuring Pachyderm
      2. Getting data into Pachyderm
    2. Integrating our CNN
      1. Creating a Docker image of our CNN
      2. Updating our CNN to save the model
      3. Creating a data pipeline
      4. Interchangeable models
      5. Mapping predictions to models
      6. Using the Pachyderm dashboard
    3. Summary
  18. Scaling Deployment
    1. Lost (and found) in the cloud
    2. Building deployment templates
      1. High-level steps
      2. Creating or pushing Docker images
      3. Preparing your AWS account
      4. Creating or deploying a Kubernetes cluster
        1. Kubernetes
      5. Cluster management scripts
      6. Building and pushing Docker containers
    3. Running a model on a K8s cluster
    4. Summary
  19. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Hands-On Deep Learning with Go
  • Author(s): Gareth Seneque, Darrell Chua
  • Release date: August 2019
  • Publisher(s): Packt Publishing
  • ISBN: 9781789340990