Book Image

Hands-On Deep Learning with Go

By : Gareth Seneque, Darrell Chua
Book Image

Hands-On Deep Learning with Go

By: Gareth Seneque, Darrell Chua

Overview of this book

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.
Table of Contents (15 chapters)
Free Chapter
1
Section 1: Deep Learning in Go, Neural Networks, and How to Train Them
6
Section 2: Implementing Deep Neural Network Architectures
11
Section 3: Pipeline, Deployment, and Beyond!

Solving a maze using a DQN in Gorgonia

Now, it's time to build our maze solver!

Using a DQN to solve a little ASCII maze is a bit like bringing a bulldozer to the beach to make sandcastles for your kids: it's completely unnecessary, but you get to play with a big machine. However, as a tool for learning about DQNs, mazes are invaluable. This is because the number of states or actions in the game is limited, and the representation of constraints is also simple (such as the walls of our maze that our agent cannot move through). This means that we can step through our program and easily inspect what our network is doing.

We will follow these steps:

  1. Create a maze.go file for this bit of code
  2. Import our libraries and set our data type
  3. Define our Maze{}
  4. Write a NewMaze() function to instantiate this struct

We also need to define our Maze{} helper functions. These include...