# What is a Deep Neural Network?

November 24, 2020 2020-12-03 21:17## What is a Deep Neural Network?

A deep neural network is an interconnection of neurons collectively working together. It is made up of three different types of layers:

**Input Layer:**The input layer is responsible for feeding the data into the network.**Hidden Layer(s):**The hidden layer(s)**Output Layer**: The output layer is responsible for outputting the prediction from the network.

Here is a sample architecture of a deep neural network, which has an input layer, two hidden layers (with three neurons each) and one output layer.

This may look overwhelming at a first glance but let us put this diagram in comparison to that of a neuron.

In a deep neural network, each neuron in the hidden layer is responsible for the computation of the activation function applied to the linear combination of the inputs and their respective weights.

However, since it is odd to expect different results from each neuron for the same set of inputs and weights, we provide a different set of weights to same set of inputs for each neuron. Therefore, the entire network has more parameters to learn and this makes the network more accurate in comparison to just using a single neuron.

#### How does data flow in a Deep Neural Network?

Let us continue by using a more detail diagram of the above deep neural architecture for understanding how data flows through the network.

In the beginning, all inputs () are assigned with their own set of respective weights for each neuron present in hidden layer 1 {(), (), …, ()}, where, is a positive integer.

To help you understand this notation, the subscript of , i.e., represents that the weight is assigned for the first input going into the first neuron whereas the superscript, i.e., represents the hidden layer number.

Then, the weighted inputs are passed into each neuron of hidden layer 1 for individual computation. The following mathematical equation represents the calculation done by neuron 1 of hidden layer 1,

We can also write this equation in matrix notation as,

In general practice, the value of bias, , is kept the same for each neuron in a hidden layer and different neurons may have different activation functions even in the same hidden layer.

Similarly, each neuron in hidden layer 1 computes the activation function to the linear combination of the weighted inputs of the input layer.

The set of inputs for the hidden layer 2 is now () and a new set of weights are initialized for each neuron present in hidden layer 2, i.e., {(), (), …, ()}

Then, the weighted inputs are passed into each neuron of hidden layer 2 for individual computation. The following mathematical equation represents the calculation done by neuron 2 of hidden layer 2,

We can also write this equation in matrix notation as,

Similarly, each neuron in hidden layer 2 computes the activation function to the linear combination of the weighted inputs of the hidden layer 1.

Now, the set of inputs for the output layer is now () and a new set of weights are initialized for each input, ().

Int the output layer, the computation is rather simple since there is only 1 neuron.

This is how data flows in a deep neural network.

#### Some insights about Deep Neural Networks

Before we move onto the next chapter, here are some insights about Deep Neural Networks:

- The term ‘deep’ comes from the fact that as we add more hidden layers in a deep neural network, the data has to flow deeper through the network.
- A neural network with only one hidden layer is called a shallow neural network.
- In this chapter, we studied about Dense Neural Networks. A Dense Neural Network has every single input connected with every subsequent layer of neurons in the network and hence, it gets the term ‘Dense’. There are multiple other variants of deep neural networks such as Convolutional Neural Networks, AutoEncoders, Recurrent Neural Networks, etc.

Hope this proves to be useful! Now, let’s understand how a deep neural network learns in the next and final chapter of this course.