Professional Documents
Culture Documents
𝑧 = 𝑥1 𝑤1 + 𝑥2 𝑤2 + ⋯ + 𝑥𝑛 𝑤𝑛 = 𝑤𝑖 𝑥𝑖
𝑖=1
The weighted inputs are all summed up inside the computing unit
(artificial neuron). In case the weighted sum is zero, bias is added to
make the output not- zero or to scale up the system response. Bias has
the weight and input always equal to ‘1'.
The activation function is set to the transfer function to get the desired
output. There are linear as well as the nonlinear activation function.
Important terms associated with model of Artificial Neuron
Input Nodes: These are the nodes to which input signals are
applied. For example: 𝑥1 , 𝑥2 ,…𝑥𝑛 are input nodes.
Output Nodes: These are the nodes from which final output is
taken. For example: 𝑦1 , 𝑦2 ,…𝑦𝑛 are output nodes.
Weights: Each neuron in the network is interconnected with other
neurons by direct communication links. Each link is associated
with a weight, which contains information about the signal
flowing through the link.
Hidden Layers: These are the nodes that lie in between input and
output node layers.
Bias: The bias is a constant signal value which is added o a
neuron. It is just like another weighted link with a constant signal
value generally taken as 1.
Activation function: Each neuron or node has an activation
function associated with it and determines the input and output
relationship for the neuron. It can be linear or non linear.
Differences between ANN and NN
Question: Explain the difference between ANN & BNN
ANN BNN
It is short for Artificial Neural Network. It is short for Biological Neural Network.
Processes operate in sequential mode. The process can operate in massive parallel operations.
If any information gets corrupted in the memory it Information is distributed into the network throughout into
cannot be retrieved. sub-nodes, even if it gets corrupted it can be retrieved.
The activities are continuously monitored by a control There is no control unit to monitor the information being
unit. processed into the network.
Bias
Bias is a constant which helps the model in a way that it can fit best
for the given data.
Each neuron has Bias.
Bias increases flexibility of the model.
In case of Bias 𝑏, net input is given by,
𝑧 = 𝑥1 𝑤1 + 𝑥2 𝑤2 + ⋯ + 𝑥𝑛 𝑤𝑛 + 𝑏
Bias
Bias can also be added if net input is zero
For example:
𝑏=1
Importance of Activation Function
Question: Define Activation function and explain any three-activation function.
Also without activation function our neural network would not able
to learn and model other complicated kinds of data such as images,
videos, audio, speech etc.
Desirable features of an activation function
Vanishing Gradient problem: If slope of tangent is zero then
learning become slow and it is called as vanishing gradient.
1 𝑖𝑓 𝑧 > 𝜃
𝜑 𝑧 =ቊ
0 𝑖𝑓 𝑧 ≤ 𝜃
where 𝜃 is called threshold value Vanishing Gradient
1
𝜑 𝑧 =
1 + 𝑒 −𝛼𝑧
Vanishing Gradient
𝑒 𝑧 − 𝑒 −𝑧
𝜑 𝑧 = 𝑡𝑎𝑛ℎ 𝑧 = 𝑧
𝑒 + 𝑒𝑧
Vanishing Gradient
𝑅𝑒𝐿𝑈 𝑧 = max(0, 𝑧)
Vanishing Gradient
Important Activation Functions
Leaky ReLU function
This neural network may or may not have the hidden layers..
Example:
Consider Single layer feed-forward
network. Here, the net input is
calculated and fed to the output.
Feedforward Neural Network
Applications
Calculate what will be the output value 𝑦 of the unit for each of the following
input patterns:
Examples
Q.2 Consider single layer feed forward network having weights are 𝑤1 =
1, 𝑤2 = 1
Step 2: The updated weight and bias by Hebb rule is given by,
𝒘𝒊 𝒏𝒆𝒘 = 𝒘𝒊 𝒐𝒍𝒅 + 𝜶𝒙𝒊 𝒚𝒕
𝒃 𝒏𝒆𝒘 = 𝒃 𝒐𝒍𝒅 + 𝒚𝒕
where 𝛼 is learning rate varying between 0 & 1
Change in weight
Step 3: Repeat step 2 for each input vector
-1 -1 -1 -1 -1 -1
-1 1 1 1 -1 1
-1 -1 -1 1 -1 1
Pattern 1 Pattern 2
Solution:
Pattern 1 input can be written as,
x1 1 1 1 1 1 1 1 1 1
Example
Pattern 2 input can be written as,
x2 1 1 1 1 1 1 1 1 1
Consider initial weight as,
w0 0 0 0 0 0 0 0 0 0
By Hebb Rule,
𝒘𝒊 𝒏𝒆𝒘 = 𝒘𝒊 𝒐𝒍𝒅 + 𝜶(𝒙𝒊 𝒚)
w1 w0 1( x1T 1) (consider transpose so that matrix
product is possible)
w1 1 1 1 1 1 1 1 1 1
T
w2 w1 1 ( x2T y2 )
Example
w2 w1 1( x2T y2 )
w2 1 1 1 1 1 1 1 1 1
T
1 1 1 1 1 1 1 1 1 1 1
T
w2 0 0 0 2 2 0 2 0 2
1
Case II: y = 𝜑 𝑧 =
1+𝑒 −𝑧
𝑒 −𝑧
∴ 𝜑′ 𝑧 =
1 + 𝑒 −𝛼𝑧 2
′
1 1
∴𝜑 𝑧 = −𝑧
1−
1+𝑒 1 + 𝑒 −𝑧
∴ 𝜑′ 𝑧 = 𝑦 1 − 𝑦
𝒘𝒊 𝒏𝒆𝒘 = 𝒘𝒊 𝒐𝒍𝒅 + 𝜶 𝒚𝒕 − 𝒚 𝒚 𝟏 − 𝒚 𝒙𝒊
𝒃 𝒏𝒆𝒘 = 𝒃 𝒐𝒍𝒅 + 𝜶 𝒚𝒕 − 𝒚 𝒚 𝟏 − 𝒚
Examples on Delta Learning Rule
Q. Implement Bipolar OR function with bias using Delta Learning
Rule. Perform 1 Epoch [Take 𝛼 = 0.1, 𝜑 𝑧 = 𝑧]
Solution:
Q. Find weights of the following ANN model using Delta Learning
1
Rule [Take 𝛼 = 1, 𝜑 𝑧 = −𝑧 ]
1+𝑒
𝒙𝟏 𝒙𝟐 𝒚𝒕
1 0.167 0.93
0.83 0.583 0.57
1 0.916 0.3
Competitive Learning
In competitive learning, the
neural network consists of
single layer output neurons.
All the output neurons are fully connected to the input neurons.
Mathematically,
1 𝑖𝑓 𝑧𝑘 > 𝑧𝑗 𝑓𝑜𝑟 𝑎𝑙𝑙 𝑗
𝑦𝑘 = ቊ
0 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Where 𝑧𝑘 = net input of 𝑘 𝑡ℎ neuron
This rule is called “Winner-takes all” because only the winning
neuron is updated and rest of the neurons are left unchanged.
Thank You