Neural Networks: Associate Professor Department of Management Studies
Neural Networks: Associate Professor Department of Management Studies
Dr. A. Ramesh
Associate Professor
Department of Management Studies
Agenda
Neural Networks 2
Introduction
Neural Networks 3
Advantages of Neural Networks
Neural Networks 4
Applications of Neural Networks
1. Computer Vision
• The ability to extract information and
insights from images and videos.
• With neural networks, computers can
distinguish and recognize images
Examples:
1. Self-driving cars to recognize road signs
2. Facial recognition
3. Image labeling to identify brand logos,
clothing, safety gear, etc.
Neural Networks 5
Applications of Neural Networks
2. Speech Recognition
• Neural networks can analyze human speech despite varying
speech patterns, pitch, tone, language, and accent.
• Virtual assistants like Amazon Alexa rely on speech
recognition techniques.
Examples:
1. Assist call center agents and automatically classify calls
2. Convert clinical conversations into documentation in real
time
3. Accurately subtitle videos and meeting recordings for
wider content reach
Neural Networks 6
Applications of Neural Networks
3. Predictive Maintenance
• Predictive maintenance is a growing application of
ANNs for improving equipment reliability and
reducing downtime.
• ANNs are used to analyze data from equipment
sensors to identify patterns and anomalies that
indicate when equipment is likely to fail.
• This helps companies to reduce maintenance costs
Neural Networks 7
Conclusion
Neural Networks 8
Recap to Linear & Logistic Regression
Dr. A. Ramesh
Associate Professor
Department of Management Studies
Agenda
Neural Networks 10
Brief Recap
• Before studying Neural Networks, let us quickly recap Linear and Logistic
regression
• This will help us to easily understand the workings of Neural Networks
Neural Networks 11
Recap – Linear Regression
Neural Networks 12
Recap – Linear Regression
Neural Networks 13
Recap – Linear Regression
• Our aim is to determine w0, w1, …. , wn such that the Mean Squared Error
is minimized.
Neural Networks 14
Recap – Logistic Regression
Neural Networks 15
Recap – Logistic Regression
Neural Networks 16
Recap – Logistic Regression
The error function used for Logistic Regression is known as log-loss function.
Neural Networks 17
Gradient Descent
Neural Networks 18
Gradient Descent
Neural Networks 19
Conclusion
Neural Networks 20
Elements of Neural Network
Dr. A. Ramesh
Associate Professor
Department of Management Studies
Agenda
Neural Networks 22
Elements of Neural Networks - Layers
• A Neural Network consists of one input layer, one output layer and one
or more hidden layers.
Neural Networks 23
Elements of Neural Networks - Layers
Neural Networks 24
Elements of Neural Networks - Layers
• The data scientist defines the number of hidden layers and neurons
present in them for the NN based on expertise and model performance
• It is recommended to try different number of hidden layers and select
the model with highest performance.
• You should note that using very high number of hidden layers may lead
to overfitting, which should be avoided.
Neural Networks 25
What happens inside a Neural Network?
2 hidden layers
X2
1 output variable
X3
Neural Networks 26
What happens inside a Neural Network?
Neural Networks 27
Hidden Layer Neurons
• Every hidden layer neuron is associated with a set of weights and a bias
• The output layer also has its own set of weights and bias
w11, w12, w13, b1 w’11, w’12, w’13, b’1
Neural Networks 28
Hidden Layer Neurons
• For every iteration, a hidden neuron performs two tasks:
1. Weighted summation of the inputs (z = w11x1 + w12x2 + …. w1nxn)
2. Applying the activation function (σ) to the weighted sum ‘z’.
This value σ(z) becomes the input for the next hidden layer neurons
Hidden Layer Neuron
X1
σ(z)
X2 σ(z)
Z = wx + b σ(z)
σ(z)
X3
Neural Networks 29
Hidden Layer Neurons
X1
σ(z)
X2 σ(z)
Z = wx + b σ(z)
σ(z)
X3
Neural Networks 30
Conclusion
Neural Networks 31
Activation functions
Dr. A. Ramesh
Associate Professor
Department of Management Studies
Agenda
Neural Networks 33
Activation functions
Neural Networks 34
Activation functions
Neural Networks 35
Activation functions
Sigmoid function
• Range : (0 , 1)
Neural Networks 36
Activation functions
Neural Networks 37
Activation functions
Tanh function
Range: (-1, 1)
Neural Networks 38
Activation functions
• A neural network will almost always have the same activation function in
all hidden layers.
• The activation function for output layer is usually different than the
activation function for hidden layers.
Neural Networks 39
Activation functions for Output Layer
Neural Networks 40
Activation function for Output Layer
Neural Networks 41
Activation functions for Output Layer
σ3(z)
• Ypred = Sigmoid(W1.σ1(z) + W2.σ2(z) + W3.σ3(z) + Sigmoid activation
W''11, W''12, W''13,...., B
W4.σ4(z) + B)
σ4(z)
Neural Networks 42
Activation functions for Output Layer
+ W4.σ (z) + B)
4
Neural Networks 43
Error function for Neural Networks
• The error function for Neural Network also depends on the type of
problem.
• As discussed earlier, the Mean Squared Error is used for regression
problems
• The Log-loss function is used for Classification problems
• The aim is to determine the weights and bias values for all hidden layers
and the output layer such that our Error function is minimized.
Neural Networks 44
Gradient Descent
• Initially, all weights and bias values are chosen randomly as discussed
earlier
• We use gradient descent to determine the optimal values for weights
and biases of the Neural Network that minimize the error function.
Neural Networks 45
Conclusion
Neural Networks 46
Numerical Example for Neural Network
Dr. A. Ramesh
Associate Professor
Department of Management Studies
Agenda
Neural Networks 48
Example for Neural Networks
X1 X2 Y
5 5 10
Neural Networks 49
Example for Neural Networks
X2
Neural Networks 50
Calculation for Hidden Layer - 1
Input Data
X1 X2 Y
• Let the weights and bias for Hidden Layer Neuron be:
w1= 0, w2 = 0.5, b= 1 5 5 10
Neural Networks 51
Calculation for Hidden Layer - 2
• Let the weights and bias for Hidden Layer-2 Neuron be:
w1= 1, b= 2
We do not have w2 in this case since there is only one input (Y1) for Hidden Layer -2
Thus, the weighted summation will be:
Z = w1Y1 + b
= 1 x 0.97 + 2
Z2 = 2.97
The output from 2nd hidden layer will the Sigmoid(z):
Sigmoid(z) = 1 / (1 + e-z ) = 1/ (1+ e-2.97) = 1/ 1.0513
Y2 = Sigmoid(z) = 0.953 Y1 Y2
Neural Networks 52
Calculation for Output Layer
• Let the weights and bias for Output Layer Neuron be:
W1= 10, B= 10
Thus, the weighted summation will be:
Z3 = W1 Y2 + b
= 10 x 0.953 + 10
Z3 = 19.53
Y1 Y2
Neural Networks 53
Example for Neural Networks
X1 = 5
X2 = 5
Y_pred = 19.53
Y1 = 0.97 Y2 = 0.9523
Z = 19.53
• The Z value for output layer will be passed through the Linear activation function (y=x)
• Thus, the output of the output layer .i.e. Ypred = Y2 = 19.53
Neural Networks 54
Example for Neural Networks
• Now that we have our Ypred value, the error can be calculated
• Since this is a regression problem, the error function will be Mean
Squared Error
X1 X2 Y
• Ypred = 19.53 ; Yactual = 10
• The MSE will be: 5 5 10
Neural Networks 55
Conclusion
Neural Networks 56
57