Visualizing our Toy Neural Network

In my previous post , we implemented our own neural network from scratch in python. In this post, we are going to visualize our network and gain some insights about it.As a remainder, a neural network is nothing but a bunch of neurons connected together to identify or approximate a function which maps input to output.To move on with this post,please revise my old post to refresh the concepts.

This is the code used in my previous post to implement the neural network.The main essence of the neural network lies in the for loop.Let’s visualize what it does.

The input is plotted along x-axis and the output is plotted along y-axis.At first,the neural network guesses the weight and computes a function (y= weight * input).After plotting the function , we observe that the line is not closer to the data point (1 , 4) .So we update the weight in order to fit the data point with the line.The line is nothing but the equation (y= weight * input ).If we found the best line, we can substitute any arbitrary input value to the network and get the correct output. In our example, the correct weight is 4.If we substitute the input value as 2, then we would get 8 as the output(y = 4 * 2).

Leave a comment