Module5
Module5
CLASSIFICATION MODELS
Content
➢ Biological neuron and Artificial neuron
➢ McCulloch-Pitts Model
➢ Activation Function, various types of Activation Functions and types
of Neural Network Architectures
➢ Prerequisites for Training of Neural Networks. Linearly Separable and
Linearly Non-Separable Systems with examples
➢ Concepts of Supervised Learning, Unsupervised Learning, and
Reinforcement Learning.
➢ Brief survey of applications of Neural Networks.
Course outcome:
Comprehend the concepts of biological neurons and artificial neurons
Artificial Neural Networks
➢ What is natural neural network?
➢ Human brain: highly complex, non-linear, parallel computer
➢ Neuron: structural constituents of the brain
yin = x1 w1 + x2 w2 + − − − − − + xm wm + bk
m
yin = xi wi + bk
i =1
y = f ( yin )
Output = Function (net input calculated)
For example, consider following output.
f ( yin ) = 1 if yin
0 if yin
Where, Ɵ is a threshold parameter
An artificial neuron:
- computes the weighted sum of its input (called its net input)
- adds its bias
- passes this value through an activation function
We say that the neuron “ fires” (i.e. becomes active ) if its output is above zero.
Artificial Neural Network(ANN) Biological Neural Network(BNN)
Processing speed is fast as compared to
They are slow in processing information.
Biological Neural Network.
Allocation for Storage to a new process is Allocation for storage to a new process is
strictly irreplaceable as the old location is easy as it is added just by adjusting the
saved for the previous process. interconnection strengths.
Given data:
[x1, x2, x3] = [0.3, 0.5, 0.6] and [w1, w2, w3] = [0.2, 0.1, -0.3]
The net input can be calculated as,
Example 2: Calculate the net input for the network shown in figure
with bias included in the network?
Example 3: Implement AND function using McCulloch-Pitts
Neuron (take binary data).
SOLUTION: x1 x2 y
Truth table of AND gate is
0 0 0
In McCulloch-Pitts Neuron only analysis
is performed. Hence, assume weights 0 1 0
be w1 = w2 = 1. 1 0 0
The network architecture is 1 1 1
With these assumed weights the net input is calculated for four inputs,
For AND function, the output is high if both the inputs are high.
For this function, the net input is calculated as 2. Hence, based on this input
the threshold value is set, i.e., if the output value is greater than or equal to 2
then the neuron fires, else it does not fire.
So, the threshold value is set to 2 (θ=2).
This can be obtained by,
Example 4: Implement OR function using McCulloch-Pitts
Neuron (take binary data).
SOLUTION: x1 x2 y
Truth table of OR gate is
0 0 0
In McCulloch-Pitts Neuron only analysis
is performed. Hence, assume weights 0 1 1
be w1 = w2 = 1. 1 0 1
The network architecture is 1 1 1
With these assumed weights the net input is calculated for four
inputs,
Thus, the weights are obtained as following for the XOR function,
w11 = w22 = 1 (excitatory)
w12 = w21 = −1 (inhibitory)
v1 = v2 = 1 (excitatory)
Example 7: Implement OR function using McCulloch-Pitts
Neuron (take bipolar data).
SOLUTION: x1 x2 y
Truth table of OR gate is
In McCulloch-Pitts Neuron only analysis
-1 -1 -1
is performed. Hence, assume weights -1 1 1
be w1 = w2 = 1. 1 -1 1
The network architecture is 1 1 1
Yin = x1*w1 + x2*w2
(-1,-1) – Yin = (-1)*1 + (-1)*1 = - 2
(-1,1) – Yin = -1*1 + 1*1 = 0
(1,-1) – Yin = 1*1 + (-1)*1 = 0
(1,1) – Yin = -1*1 + 1*1 = 2
For this weight, it is possible to get the desired output. Here,
output will be 1 if the net input is greater than or equal to 0.
So, the threshold is 0.
Y = 1 ; Yin >= 0
0 ; Yin < 0
Linear Separability
• Separation of the input space into regions is based on whether
the network response is positive or negative
• Line of separation is called linear-separable line.
• Examples:-
– AND function & OR function are linear separable.
– XOR function is Linearly Non-separable.
OR function with binary data:
output y = 1 ; if yin >=1
= 0 ; if yin < 1
yin = x1w1 + x2w2 and w1 = w2 = 1, so yin = x1 + x2
here y = 1 if x1 + x2 >= 1 else it is 0
X2
(0,1) (1,1)
X1
(0,0) (1,0)
AND function:
output y = 1 ; if yin >= 2
= 0 ; if yin < 2
yin = x1w1 + x2w2 and w1 = w2 = 1, so yin = x1 + x2
here y = 1, if x1 + x2 >= 2 else it is 0
X2
(0,1) (1,1)
X1
(0,0) (1,0)
XOR function:
Output is 1 if input is either (0,1) or (1,0) and it is 0, if input is (0,0)
or (1,1).
Linearly Non-separable function.
X2
(1,1)
(0,1)
X1
(0,0) (1,0)
Example 7: Implement 3-input OR function using McCulloch-Pitts
Neuron (take binary data).
SOLUTION:
Lets assume weights be w1 = w2 = w3 = 1. x1 x2 x3 y
The network architecture is
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 1
y = 1 ; if Yin >= 1 1 1 0 1
Where Yin = x1w1 + x2w2 + x3w3
i.e. Yin = x1 + x2 + x3 1 1 1 1
3-input OR function:
x1 x2 x3 y x1 + x2 + x3 ≥ 1
0 0 0 0 X2
0 0 1 1 (0,1,0)
0 1 0 1 (1,1,0)
0 1 1 1
1 0 0 1 (0,1,1) (1,1,1)
1 0 1 1 X1
(0,0,0)
1 1 0 1 (1,0,0)
(0,0,1)
1 1 1 1
(1,0,1)
X3
Characterization of Neural Network
➢ Activation Function
– Function to compute output signal from input signal
➢ Architecture
– a pattern of connections between neurons
• Single Layer Feed-forward
• Multilayer Feed-forward
• Recurrent
➢ Strategy / Learning Algorithm
– a method of determining the connection weights
• Supervised
• Unsupervised
• Reinforcement
Learning
➢ Two broad kinds of learning in ANNs is :
i) Parameter learning – updates connecting weights in a
neural net.
ii) Structure learning – focus on change in the network.
➢ Apart from these, learning in ANN is classified into three
categories as
i) supervised learning
ii) unsupervised learning
iii) reinforcement learning
你好吗 ਤੁਸੀ ਕਿਵੇਂ ਹੋ Қалайсыз ਤੁਸੀਂ ਿੀ ਿਰਦੇ ਹੋ
ਤੁਹਾਡਾ ਨਾਮ ਿੀ
сенің атың кім 你叫什么名 сен не істейсің
ਹੈ 字
你做什么 ਿੀ ਤੁਸੀਂ ਸਿੂਲ сен мектепке
ਜਾਂਦੇ ਹੋ 你去学校吗
祝你有美好的 ਤੁਹਾਡਾ ਕਦਨ күніңіз жақсы қайырлы таң
一天 ਚੰ ਗਾ ਬੀਤੇ өтсін
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
你好吗 ਤੁਸੀ ਕਿਵੇਂ ਹੋ Қалайсыз ਤੁਸੀਂ ਿੀ ਿਰਦੇ ਹੋ
ਤੁਹਾਡਾ ਨਾਮ ਿੀ
сенің атың кім 你叫什么名 сен не істейсің
ਹੈ 字
你做什么 ਿੀ ਤੁਸੀਂ ਸਿੂਲ сен мектепке
ਜਾਂਦੇ ਹੋ 你去学校吗
祝你有美好的 ਤੁਹਾਡਾ ਕਦਨ күніңіз жақсы қайырлы таң
一天 ਚੰ ਗਾ ਬੀਤੇ өтсін
1 2 3 4 Group 1: 1, 7, 9, 12, 13
5 6 7 8 Group 2: 2, 4, 5, 10, 14
9 10 11 12 Group 3: 3, 6, 8, 11, 15, 16
13 14 15 16
你好吗 ਤੁਸੀ ਕਿਵੇਂ ਹੋ Қалайсыз кешкі жұлдыз
你去学校吗 ਤੁਹਾਡਾ ਨਾਮ ਿੀ сенің атың
ਹੈ кім
你做什么 ਿੀ ਤੁਸੀਂ ਸਿੂਲ сен
你有笔吗
ਜਾਂਦੇ ਹੋ мектепке
祝你有美好的 ਤੁਹਾਡਾ ਕਦਨ күніңіз
一天 ਚੰ ਗਾ ਬੀਤੇ жақсы өтсін
你叫什么名字 ਤੁਸੀਂ ਿੀ ਿਰਦੇ ਹੋ сен не
істейсің ਕੀ ਤੁਹਾਡੇ ਕੋਲ
ਕਲਮ ਹੈ
Chinese Punjabi Kazakh
你好吗 ਤੁਸੀ ਕਿਵੇਂ ਹੋ Қалайсыз кешкі жұлдыз
你去学校吗 ਤੁਹਾਡਾ ਨਾਮ ਿੀ сенің атың Kazakh
ਹੈ кім
你做什么 ਿੀ ਤੁਸੀਂ ਸਿੂਲ сен
你有笔吗
ਜਾਂਦੇ ਹੋ мектепке
祝你有美好的 ਤੁਹਾਡਾ ਕਦਨ күніңіз Chinese
一天 ਚੰ ਗਾ ਬੀਤੇ жақсы өтсін
你叫什么名字 ਤੁਸੀਂ ਿੀ ਿਰਦੇ ਹੋ сен не
істейсің ਕੀ ਤੁਹਾਡੇ ਕੋਲ
ਕਲਮ ਹੈ
Chinese Punjabi Kazakh Punjabi
Supervised learning
Result: square
Unsupervised learning
where, λ represents
steepness parameter. The
range of sigmoid function is
0 to 1.
Derivative of the function:
b) Bipolar sigmoid function: This function is defined as
𝞴𝑥
= tanh
2
U V W
➢ This network is formed by the interconnection of several layers.
➢ Input layer receives input and buffers input signal.
➢ Output layer generated output.
➢ Layer between input and output is called hidden layer.
➢ Hidden layer is internal to the network.
➢ There can be one to several hidden layers in a network.
➢ More the hidden layer more is the complexity of network, but
efficient output is produced.
➢ The existence of one or more hidden layers enables the
network to be computationally stronger.
Advantages of Feed Forward Neural Networks
1. Less complex, easy to design & maintain
2. Fast and speedy [One-way propagation]
3. Highly responsive to noisy data
Disadvantages of Feed Forward Neural Networks:
1. Cannot be used for deep learning [due to absence of dense
layers and back propagation]
Single node with own feedback
W11 y1
x1 X1 Y1
W12
W1n
W21
W22 y2
x2 X2 Y2
W23
Wn1 Wn2
yn
xn Xn Wnn Yn
Multi-layer Feed-forward Network
Hidden Layers
Input Layer Output Layer
y1
x1 X1 R1 S1 Y1
y2
x2 X R2 S2 Y2
2
yn
x n Xn Rn Sn Yn
Multi-layer Feed-forward Network
x1 X1 Z1
x2 X Y y
2 Z2
Zn
x n Xn
1
Single layer recurrent neural Network
W11 y1
x1 X1 Y1
W22 y2
x2 X2 Y2
yn
xn Xn Wnn Yn
Multi-layer recurrent network
y1
x1 X1 R1 Y1
y2
x2 X R2 Y2
2
yn
x n Xn Rn Yn