top of page

Day 20: Inference-making predictions (forward propagation)

Let's take what we have learned and put it together into an algorithm to let our neural network make inferences or predictions. This will be an algorithm called forward propagation.


Let's use an example, handwritten digit recognition and for simplicity, we will distinguish between 0 and 1. It is a binary classification problem where we are going to input an image and classify, is this digit 0 or 1?


For this example, we're going to use a 8x8 image and this image of 1 is the grid or matrix of 64 pixels intensity values where 255 denotes a bright white pixel and 0 denotes a black pixel, and different numbers are different shades of gray between black and white.

Given these 64 input features, we are going to use the neural network with 2 hidden layers:


First, Compute a[1]:


Next, compute a[2]:

Finally, we'll compute a[3]:

Is a[3] more than or equal to the threshold we set, 0.5?

if yes, then the prediction is 1, the handwritten digit is 1

if no, then the prediction is 0, the handwritten digit is not 1


Because this computation goes from left to right (starting at x or a[0] -> a[1] -> a[2] -> a[3]), this algorithm is called forward propagation, as we're propagating the activations of the neurons.

This is in contrast to a different propagation called backward propagation.



Recent Posts

See All

Day 39: Tree Ensembles

Using Multiple Decision Trees One of the weaknesses of using a single decision tree is that decision tree can be highly sensitive to small changes in the data. One solution to make the algorithm less

Comentários


bottom of page