Deep Learning 10 Hours: - Artificial Neural Networks (ANN) : Architecture
Deep Learning 10 Hours: - Artificial Neural Networks (ANN) : Architecture
• Activation functions
• Regularization techniques
• Transfer learning
19-03-2024 2
Single-Layer Neural Networks
Bias
3
Training of a Single-Layer Neural Network: Delta Rule
4
Training of a Single-Layer Neural Network: Delta Rule
Updated weights
5
Training process using the delta rule for the single-layer
neural network-“Supervised Learning of a Neural Network”
6
Generalized Delta Rule
• For an arbitrary activation function, the delta rule is expressed as
7
Delta rule with the sigmoid function
8
Calculation of weight updates
9
Stochastic Gradient Descent
10
Batch
• Each weight update is calculated
for all errors of the training data,
and the average of the weight
updates is used for adjusting the
weights.
• The single-layer neural network can only solve linearly separable problems.
• This is because the single-layer neural network is a model that linearly divides
the input data space.
• This need has led to the appearance of the multi-layer neural network
13
Artificial Neural Network Architecture
14
Feed-Forward Neural Networks
• A collection of neurons connected together in a network can be represented by a directed graph.
• Nodes represent the neurons, and arrows represent the links between them.
• Each node has its number, and a link connecting two nodes will have a pair of numbers (e.g. (1, 4) connecting
nodes 1 and 4).
• Networks without cycles (feedback loops) are called a feed-forward networks (or perceptron)
• Input nodes of the network (nodes 1, 2 and 3) are associated with the input variables (x1, . . . , xm). They do not
compute anything, but simply pass the values to the processing nodes.
• Output nodes (12 and 13) are associated with the output variables (y1, . ..yn).
• Neural networks can have several hidden layers.
4 8
• The signal flows only into one direction (from
1
the inputs to the outputs)
Feed Forward Neural Networks can be used 5 9 12
for classification and in unsupervised learning 2
as auto-encoders. 6 10 13
3
N-layer neural network:
One N − 1 layers of hidden units 7 11
One output layer 15
Number of Neurons In Input and Output Layers
• The number of neurons in the input layer is equal to the number of features in
the data and in very rare cases, there will be one input layer for bias.
• If the model is a regressor, then the output layer will have only a single neuron.
• In case if the model is a classifier, it will have a single neuron or multiple neurons
depending on the class label of the model.
16
Number of Neurons in Hidden Layer
• The number of hidden neurons should be between the size of the input layer and the size of the
output layer.
• The number of hidden neurons should be 2/3 the size of the input layer, plus the size of the
output layer.
• The number of hidden neurons should be less than twice the size of the input layer.
• Most of the problems can be solved by using a single hidden layer with the number of neurons
equal to the mean of the input and output layer.
• If less number of neurons is chosen it will lead to underfitting and high statistical bias.
• Whereas if we choose too many neurons it may lead to overfitting, high variance, and increases
the time it takes to train the network.
17
Training of Multi-Layer Neural Network
• Back-propagation algorithm - solved the training problem of the multi-layer neural network.
• Significance of the back-propagation algorithm - it provided a systematic method to determine
the error of the hidden nodes.
• Once the hidden layer errors are determined, the delta rule is applied to adjust the weights.
• In the back-propagation algorithm, the output error starts from the output layer and moves
backward until it reaches the right next hidden layer to the input layer. This process is called
backpropagation, as it resembles an output error propagating backward.
• Even in back-propagation, the signal still flows through the connecting lines and the weights are
multiplied. The only difference is that the input and output signals flow in opposite directions.
18
Back-propagation algorithm
The output error starts from the output layer and moves backward
until it reaches the right next hidden layer to the input layer.
19
Back-propagation algorithm
• Neural network that consists of two
nodes for the input and output and a
hidden layer, which has two nodes.
Weighted sum of the hidden node is Weighted sum of the output nodes is
20
Back-propagation algorithm
Train the neural network using the back-propagation algorithm
23
Back-propagation algorithm
24
Back propagation algorithm
1. Initialize the weights with adequate values.
2. Enter the input from the training data { input, correct output } and obtain the neural network’s output.
Calculate the error of the output to the correct output and the delta, δ, of the output nodes.
3. Propagate the output node delta, δ, backward, and calculate the deltas of the immediate next (left) nodes.
4. Repeat Step 3 until it reaches the hidden layer that is on the immediate right of the input layer.
5. Adjust the weights according to the following learning rule.
25