Deep-Learning As Explained To A 6th Grader

Source: Deep Learning on Medium

Deep-Learning As Explained To A 6th Grader

Deep Learning is a type of machine learning and is a popular method these days to make data predictions. To apply deep learning predictive models you need a strong understanding of linear algebra and to create them from scratch you need a background in calculus and differential equations.

Lucky for you, today you have me! I’m going to explain deep learning using only basic algebra.

Let’s get started!

So let’s say we have a data set that shows the relationship between plant growth and time, i.e. we water some plants over the course of several days and record their growth on a chart!

As one might expect, our plants get taller over time! Now let’s say we have a new plant (shown in blue on day 0) and we want to use our knowledge of past plant growth to predict how tall our plant will grow by day 4. How will we do this?

Well, if we are keeping our guess simple, we assume a linear relationship between height and time, and project out where the blue dot will be at day 4. From our yellow trend line, it looks like our plant will be around 4.5cm on day 4.

This method is called linear regression modeling and was the way the best predictions were made prior to machine learning and deep learning.

Now let’s say we watered our plant for the next 4 days and recorded the actual growth results (the blue dots). Next, we determined how close our predictions were to the actual height of the plant, and marked this distance in red.

From the graph above, we see that our predictions did pretty well. The red lines show how far off our predictions were (the prediction errors) at various points in time. The yellow line is the height we would have predicted the plant to be, and the blue dots indicate how tall our plant was at a given time. Our predictions were not off by much.

So we were pretty good, but can we do better? Almost certainly, by using deep learning.

To build a deep learning prediction model, we make no assumptions about the relationship between height and time. Our deep learning model will learn this relationship on its own. And, in fact, often times in real data sets, the relationship isn’t easily interpretable by humans.

As an initial point, we start by saying that plant height is always 3cm. Don’t worry, out deep learning model will quickly learn this is incorrect. And yes we could have started with any trend, including the linear one above, but why not just keep things as simple as possible since our deep learning model will figure out the best relationship anyway.

At a minimum, to build a deep learning model, you need to provide 3 things:

  1. A formula that tells your deep learning model how to calculate error, e.g. the red lines we used above (the loss function)
  2. A number that specifies how quickly to adjust your predictions when they are not accurate (the learning rate)
  3. How many opportunities you want to give the model to examine the training data (e.g. the black dots but not the blue one) to guess the true relationship between variables (e.g. height and time) (number of epochs)

There are various pros and cons to choosing these parameter values differently, but this is beyond the scope of this article. Note that we don’t usually control the formula for deep learning models, as in our first linear model example, since we don’t control the variable relationships.

Let’s see how much better a deep learning model can do:

As you can see, for more complex relationships, deep learning models have the potential to predict better results (there is less red, indicating less prediction error).

In our example above we only analyzed two variables, height and time. But in more complex models, we may want to include several other variables, e.g. type of plant, temperature, etc. to generate even more accurate predictions for height. As you can anticipate, deep learning will allow us to predict results based on a better representation of variable relationships than if we were to assume a more simple relationship, e.g. linear.

The best things we can do to build good deep learning models are to make sure we have good data to feed into the model and to set up our 3 parameters reasonably.

Well that’s the jist. You will need more math and coding skills to actually apply a deep learning model in practice, but conceptually this is what is going on behind the scenes.