A detailed instructional

Image for post
Image for post
First we dominate pong, and next, the world…

Getting a computer program to learn how to play Atari games may seem like a very difficult task. Well, I’ll tell you what … it is. But believe me, if I can do it then so can you. This page assumed you have read through and somewhat slightly understand the theory of deep RL (link posted below). But beware, the theory is not enough to get an agent to learn Atari! With reinforcement learning, everything is in implementation and the devil is in the details! …


A detailed introduction

Deep reinforcement learning has got to be one of the coolest tools I have used as an engineer. Once finished, all you have to do is tell the agent what it is you want to be accomplished, and watch as the AI figures out incredibly creative ways to accomplish this task.

Understanding neural networks (explained here) is a prerequisite for deep RL. Also, deep reinforcement learning can be more easily understood if you are comfortable with tabulated reinforcement learning, which I explain in-depth here.

Difference between Tabulated RL and Deep RL

A quick summary of tabulated RL is this.

  1. The agent receives the state from the environment


The first step in learning how to make your AI teach itself

Tabulated reinforcement learning is the first algorithm in which you should learn if you want to master the art of getting your AI to teach itself in a developing, and constantly changing environment.

In general, the main idea behind reinforcement learning is that you have an Agent, Environment, State, Actions, and Rewards.

  • Agent: The agent is the thing that is living in the environment, taking in input, and performing certain actions.
  • Environment: The environment is the world that the agent is in.
  • State: A state is basically all the inputs that the agent is receiving at a particular moment.
  • Actions…


The AI is unbeatable if it goes first

Image for post
Image for post
A short video of the AI kicking my ass in tic tac toe! The AI is X, I am O. See how he traps me? *Video by author*

In this article, we will create two agents who play each other in tick tac toe until one has reached tic tac toe mastery.

Writing a program that learns to play tic tac toe is a first step in learning how reinforcement learning works. For this project, I assume you have already been introduced to the theory of tabulated reinforcement learning (which you can learn more about here). This includes understanding what the value of a state is and how to find it. I will go in-depth into implementing this theory in code. …


Without the help of any machine learning libraries

If you have read the previous articles in this series (links at bottom of page), you should have built a DNN class completely from base principles. Let’s see if we can use this class to create a neural network that’s able to read handwritten digits.

This is a classic example of something that is easy for us humans to do, but it is incredibly difficult to write a program that accomplishes the same task. In the case of us humans classifying pictures, let’s think about what is happening. …


A fundamental example of the implementation of gradient descent

We have derived an algorithm on how to implement gradient descent here, but there are a lot of nuances when implementing this algorithm in code. If you try to tackle this algorithm with a huge project right out the gate, you will find that it is very difficult to keep track of the shapes of all your matrices. Because of this, we will start very small with the same architecture we used in the derivation.

First, let’s just focus on getting a general form of this algorithm working. After we have something that works, we can clean it up and…


Deep dive into the mathematics of the gradient descent algorithm.

This post derives the algorithm for implementing gradient descent. It is messy, ugly, and tedious! It is a fun exercise deriving it yourself, but in the end, it’s just identifying patterns. Don’t let this page make your head explode and make you give up on AI! Just knowing how to use the algorithm is most important (even then it can be argued that you can just use Keras), but why not try it yourself and have some fun! I include the derivation here just because I know I would have loved to see it when I was learning AI.

We…


The intuition behind finding the weights of a neural network, with an example.

In this article, I will continue our discussion on artificial neural networks, and give an example of a very simple neural network written in python. The purpose of this series of articles I am writing is to give a full explanation of ANN’s from the ground up, with no hiding behind special libraries. Tensorflow is great for prototyping and production, but when it comes to education the only way to learn is to get a pencil and paper and get dirty in math.

In the previous article, I went over the inspiration behind an ANN and how to model the…


An intuitive introduction to artificial neural networks.

Neural networks have received a lot of hype in recent years, and for good reason. With a basic understanding of this deep learning theory, we can create technology that solves complex problems with human, and sometimes superhuman, capabilities. Whether it be advanced signal processing, object detection, intelligent decision making, or time series analysis, neural networks are a great way to add intelligence to your projects. Before I begin explaining the details of a neural network, let me tell a short story that should give some inspiration as to why artificial neural networks were created in the first place. …

Drew Parmelee

A young, multidisciplinary engineer from Michigan.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store