SC Cat1 Merged PDF
SC Cat1 Merged PDF
Course Objectives
• To understand the features of neural network
and its applications
• To learn about the concept of fuzzy logic
components
• To expose the ideas about genetic algorithm
Course Outcomes
• Ability to understand the basics of artificial
neural network and supervised learning
network
• Applying knowledge and understanding of
associative memory networks
• Applying knowledge and understanding of
unsupervised learning network
• Comprehend the fuzzy sets and the concept of
fuzziness involved in various systems
Course Outcomes
• Understand the concepts of fuzzy logic,
knowledge representation using fuzzy rules,
approximate reasoning
• Understand fuzzy concepts and develop a
Fuzzy inference system to derive decisions
• Ability to understand the concepts of genetic
Algorithm
• Apply soft computing techniques for real life
applications
RECOMMENDED BOOKS
Text Book
• S.N. Sivanandam & S.N.Deepa, “Principles of Soft Computing”, 2nd
Edition, Wiley India, 2011.
Reference Book
• Samir Roy and Udit Chakraborty, Introduction to Soft Computing,
Pearson.2013.
• Laurene Fausett, Fundamentals of Neural networks: architectures,
algorithms and applications , Pearson India, 2008
• Ross Timothy J, Fuzzy Logic with Engineering Applications, Wiley India Pvt
Ltd, New Delhi, 2010.
Module-I
Topics
• Introduction to Soft computing
• Neural networks- Introduction, evolution, basic
models, terminologies of ANN,
• Pitts model
• Perceptron
• Adaline
• Back-propagation network
• RBF network
Soft Computing
• Soft computing exploits the tolerance for imprecision,
uncertainty, and partial truth to achieve tractability,
robustness, low solution-cost, and better relationship with
reality
Soft Computing Main Components:
• Approximate Reasoning
• Search & Optimization
Neural Networks, Fuzzy Logic, Evolutionary Algorithms
Hard computing
• Conventional computing
• It requires a precisely stated analytical model
and often a lot of computation time
• Binary logic, crisp systems, numerical analysis
HARD COMPUTING SOFT COMPUTING
Precise, certain and has two valued Imprecise, uncertain and has multi
(Boolean) logic valued logic
Traditional Functional
Symbolic Numerical Approximate Approximation
Logic Modeling and Reasoning and Randomized
Reasoning Search Search
SOME APPLICATION AREAS OF
SOFT COMPUTING
• Data clustering
• Rule generation
• Image processing
• Medical diagnosis
• Pattern recognition
• Social networks
• Distributed computing
• Parallel processing
• Machine learning and
• Granular computing
OVERVIEW OF TECHNIQUES IN SOFT
COMPUTING
• Neural Networks
• Fuzzy Logic
• Genetic Algorithm
• Hybrid Systems
12
Neural Networks
• Neural network was inspired by the design and
functioning of human brain and components.
• Information processing model that is inspired by the
way biological nervous system (i.e) the brain, process
information.
• ANN is composed of large number of highly
interconnected processing elements(neurons)
working in unison to solve problems.
• It is configured for special application such as pattern
recognition and data classification through a learning
process.
• 85-90% accurate.
13
Advantages of Neural Networks
• Adaptive learning
Ability to learn how to do tasks based on the data
given for training or initial experience.
• Self-organization
Creates its own organization or representation of
information it receives during learning time.
• Real time operation
Computations can be carried out in parallel.
• Fault tolerance via redundant information coding
Partial destruction of neural network cause
degradation of performance. In some cases, it can
be retained even after major network damage.
Multi-disciplinary point of view of
Neural Networks
Application Scope of Neural Network
• Air traffic control • Employee hiring
• Animal behaviour • Expert consultants
• Appraisal and valuation of • Fraud detection
property, etc.,
• Hand writing and typewriting
• Betting on horse races, stock
markets • Lake water levels
• Criminal sentencing • Machinery controls
• Complex physical and • Medical diagnosis
chemical process • Music composition
• Data mining, cleaning and • Photos and finger prints
validation • Recipes and chemical formulation
• Direct mail advertisers • Traffic flows
• Echo patterns • Weather prediction
• Economic modeling
Fuzzy Logic
1. An organized method for dealing with imprecise data is called fuzzy
data
• Fuzzy logic includes 0 and 1 as extreme cases of truth (or "the state
of matters" or "fact") but also includes the various states of truth in
between so that, for example, the result of a comparison between
two things could be not "tall" or "short" but ".38 of tallness.“
• Allows partial membership
• Implemented in small, embedded micro controllers to large,
networked, multichannel PC or work station.
• Can be implemented in hardware, software or in both.
• Fuzzy logic provides a simple way to arrive at a definite conclusion
based upon vague, ambiguous, imprecise, noisy or missing input
information.
Genetic Algorithm
• How genes of parents combine to form those of their children.
• Create an initial population of individuals representing possible solutions
to solve a problem
• Individual characters determine whether they are less or more fit to the
population
• The more fit members will take high probability.
• It is very effective in finding optimal or near optimal solutions.
• Generate and test strategy.
• Differ from normal optimization and search procedures in:
Work with coding of the parameter set
Work with multiple points
Search via sampling( a blind search)
Search using stochastic operators
• In business, scientific and engineering circles, etc.,
Hybrid System
Neuro Fuzzy hybrid system
Combination of fuzzy set theory and neural networks
Fuzzy system deal with explicit knowledge that can be explained and
understood
Neural network deal with implicit knowledge acquired by learning
Advantages
Handle any kind of information (Numeric, Linguistic, logical)
Manage imprecise, partial, vague or imperfect information
Resolve conflicts by collaboration and aggregation.
Self-learning, self-organizing and self-tuning capability
No need for prior knowledge of relationship of data
Mimic human decision making system
Computation fast by using fuzzy number operations.
Hybrid System
Neuron genetic hybrid system
Topology optimization
Genetic algorithm used to select a topology for ANN , common one is back
propagation
Genetic algorithm training
Learning of ANN is formulated ad weight optimization problem, usually
mean squared error as a fitness measure
Control parameter optimization
Learning rate, momentum rate, tolerance level. etc., are optimized using
GA.
Hybrid System
Fuzzy genetic hybrid system
Optimization ability of GA are used to best set of rules to be
used for fuzzy inference engine
Creating the classification rules for a fuzzy system where
objects are classified by linguistic terms.
Find the appropriate set of rules
Training data and randomly generated rules are combined to
create initial population
Fitness function measures the strength of rules, balancing the
quality and diversity of the population.
NEURAL NETWORKS
Neural networks design is inspired by the design and
functioning of human brains and components
It has the ability to learn by example
It has made them very flexible and powerful tool
The networks are also well suited for real-time systems
They have fast response and less computational times
They have a parallel architecture
NEURAL NETWORKS
Resembles the characteristic of biological neural network.
Nodes – interconnected processing elements (units or
neurons)
Neuron is connected to other by a connection link.
Each connection link is associated with weight which has
information about the input signal.
ANN processing elements are called as neurons or artificial
neurons , since they have the capability to model networks of
original neurons as found in brain.
Internal state of neuron is called activation or activity level of
neuron, which is the function of the inputs the neurons
receives.
Neuron can send only one signal at a time.
ARCHITECTURE OF A SIMPLE ANN
y in x1w1 x 2 w 2 y f ( y i n ) f : Activation function
X1, X2 : Input neurons Y : Output neuron
X 1 , X 2 transmit signals,Y receives signal
x1
X1
w1
Y y
x2 w2
X2
Nucleus Strands
Axon
Dendrites
Axon Output
BIOLOGICAL NN CONTD…
In the human brain there are approximately 10000 synapses
per neuron
32
Characteristics of ANN
Neurally implemented mathematical model
Large number of interconnected processing elements called neurons exists
here.
Interconnections with weighted linkage hold informative knowledge.
Input signals arrive at processing elements through connections and
connecting weights.
Processing elements can learn, recall and generalize from the given data by
adjustment of weights
Computational power is determined by the collective behaviour of neurons.
ANN is a connection models, parallel distributed processing models, self-
organizing systems, neuro-computing systems and neuro-morphic system
BASIC MODELS OF ARTIFICIAL NEURAL NETWORK
w13
Xn Ym
wn3
38
SINGLE LAYER FEED FORWARD
NETWORK
40
Feedback Network
• If no neuron in the output layer is an input
to a node in the same layer / proceeding
layer – feed forward network.
• If outputs are directed back as input to the
processing elements in the same
layer/proceeding layer –feedback network.
• If the output are directed back to the input
of the same layer then it is lateral
feedback.
• Recurrent networks are networks with
feedback networks with closed loop.
• Fig 2.8 (A) –simple recurrent neural
network having a single neuron with
feedback to itself.
• Fig 2.9 – single layer network with
feedback from output can be directed to
processing element itself or to other
processing element/both.
41
SINGLE NODE WITH ITS OWN
FEEDBACK
Output
Input
Feedback
SINGLE LAYER RECURRENT
NETWORK
X1 w11
Y1
X2 w22
Y2
wnm
Xn Ym
Processing element output can be directed back to the processing element itself or to the
other processing element or both.
Multilayer Recurrent network
• Processing element output
can be directed back to the
nodes in the preceding layer,
forming a multilayer
recurrent network.
• Processing element output
can be directed to
processing element itself or
to other processing element
in the same layer.
44
Learning
Neural network adapts itself to a stimulus by making proper parameter
adjustment, resulting in the production of desired response.
Two broad kinds of learning in ANNs is
Parameter learning – updates connecting weights in a neural net.
Structure learning – focus on change in the networks structure
(Number of processing elements, types of
connection between nodes)
Apart from these, learning in ANN is classified into three categories as
Supervised learning
Unsupervised learning
Reinforcement learning
45
Supervised Learning
Learning with the help of a teacher.
In ANN, each input vector requires a
corresponding target vector, which
represents the desired output.
The input vector along with target vector
is called training pair.
The input vector results in output vector.
The actual output vector is compared with
desired output vector.
If there is a difference means an error
signal is generated by the network.
It is used for adjustment of weights until
actual output matches desired output.
Unsupervised learning
• Learning is performed without the help
of a teacher.
• Example: tadpole – learn to swim by
itself.
• In ANN, during training process,
network receives input patterns and
organize it to form clusters.
• From the Fig. it is observed that no
feedback is applied from environment to
inform what output should be or whether
they are correct.
• The network itself discover patterns,
regularities, features/ categories from the
input data and relations for the input data
over the output.
• Exact clusters are formed by discovering
similarities & dissimilarities so called as
self – organizing.
47
Reinforcement learning
Similar to supervised learning.
Learning based on critic information
is called reinforcement learning &
the feedback sent is called
reinforcement signal.
The network receives some feedback
from the environment.
Feedback is only evaluative.
The external reinforcement signals
are processed in the critic signal
generator, and the obtained critic
signals are sent to the ANN for
adjustment of weights properly to get
critic feedback in future.
48
Activation functions
To make work more efficient and for exact output, some force or activation
is given.
Like that, activation function is applied over the net input to calculate the
output of an ANN.
Information processing of processing element has two major parts
input and output.
An integration function (f) is associated with input of processing element.
This function serves to combine activation, information or evidence from
an external source or other processing elements into a net input to the
processing element
49
Activation functions
1. Identity function:
It is a linear function which is defined as
f(x) =x for all x
The output is same as the input. The input layer uses the identify
activation function
This function used in single layer nets to convert the net input to an output
that is bipolar (+1 or -1).
51
Activation functions
3.Sigmoid function
Back propagation nets.
Two types:
a) binary sigmoid function
logistic sigmoid function or unipolar sigmoid function.
where λ- steepness parameter and the sigmoid range is between -1 and +1.
5. Ramp function
53
54
Important Terminologies
• Weight
– The weight contain information about the input signal.
– It is used by the net to solve the problem.
– It is represented in terms of matrix & called as
connection matrix.
– If weight matrix W contains all the elements of an
ANN, then the set of all W matrices will determine the
set of all possible information processing
configuration.
– The ANN can be realized by finding an appropriate
matrix W
55
Important Terminologies
• Bias
– Bias has an impact in calculating net input.
– Bias is included by adding x0 to the input vector x.
– The net output is calculated by
57
Important Terminologies
• Learning rate
Denoted by α.
Control the amount of weight adjustment at each step of training.
The learning rate range from 0 to 1.
Determine the rate of learning at each step
• Momentum Factor
Convergence is made faster if a momentum factor is added to the weight
updation process.
Done in back propagation network.
• Vigilance parameter
Denoted by ρ.
Used in Adaptive Resonance Theory (ART) network.
Used to control the degree of similarity.
Ranges from 0.7 to 1 to perform useful work in controlling the number of
clusters.
58
Problems -1
For network shown in figure, calculate the net input to the
output neuron.
Problem -2
Calculate the net input for the network shown in figure
Problem -3
• Obtain the output of the neuron Y for the network shown in
figure using activation function
• i. Binary sigmoid ii. Bipolar sigmoid
Problem 3
Solution
𝑛
𝑦𝑖𝑛 = 𝑖 𝑥𝑖 𝑤𝑗
=b+x1W1+x2W2+x3W3 = 0.53
Binary sigmoid activation
= 0.625
Biplolar sigmoid activation function
= 0.259
Mcculloch-Pitts (M-P) neuron
Mcculloch-Pitts (M-P) neuron
Discovered in 1943.
Usually called as M-P neuron.
M-P neurons are connected by directed weighted paths.
Activation of M-P neurons is binary (i.e) at any time step the neuron may
fire or may not fire.
Weights associated with communication links may be excitatory(weights
are positive)/inhibitory(weights are negative).
Fixed threshold for each neuron and if the net input to the neuron is
greater than the threshold then the neuron fires.
They are widely used in logic functions.
64
Mcculloch-Pitts neuron
A simple M-P neuron is shown in the
figure.
It is excitatory with weight (w>0) /
inhibitory with weight –p (p<0).
In the Fig., inputs from x1 to xn possess
excitatory weighted connection and
Xn+1 to xn+m has inhibitory weighted
interconnections.
Since the firing of neuron is based on
threshold, activation function is
defined as
65
Mcculloch-Pitts neuron (Contd…)
For inhibition to be absolute, the threshold with the activation
function should satisfy the following condition:
θ >nw –p
Output will fire if it receives “k” or more excitatory inputs but
no inhibitory inputs where
kw≥θ>(k-1) w
The M-P neuron has no particular training algorithm.
An analysis is performed to determine the weights and the
threshold.
It is used as a building block where any function or
phenomenon is modeled based on a logic function.
66
Problem -4
Implement AND function using McCulloch-pitts neuron
(take binary data).
x1 x2 y
1 1 1
1 0 0
0 1 0
0 0 0
Assume weights be w1 = 1 and w2 = 1.
yin=x1w1+x2w2
(1,1) = l x 1+1 x I =2
(l,0) =1x1 +0 X 1 = 1
(0, 1) = 0 X 1+ 1 X 1 = 1
(0,0) = 0 X 1 +OX 1 = 0
The net input is calculated as 2.
if the threshold value is greater than or equal
to 2 then the neuron fires, else it does nor fire.
So the threshold value is set equal to2((ϴ= 2).
θ ≥ nw –p
n=2, w=1 p=0
ϴ≥2x1-0 => ϴ≥2
Thus , the output of neuron Y can be written
as
ϴ=2, W1=1, W2=1
SUPERVISED LEARNING NETWORK
Perceptron Networks
Perceptron Networks
The basic networks in supervised learning
The perceptron network consist of three units
– Sensory unit (input unit)
– Associator unit (hidden unit)
– Response unit (output unit)
Perceptron Networks
• Input unit is connected to hidden units with fixed weights -
1,0,-1 assigned at random
• Binary activation function is used in input and hidden unit
• Output unit (1,0,-1) activation. The binary step with fixed
threshold ϴis used as activation.
• Output of perceptron is
y f ( yin )
1ifyin
f ( yin ) 0if yin
1 yin
Perceptron Networks
• Weight updation between hidden and output unit
• Checks out for error between hidden and calculated output
layer
• Error=target-calculated output
• weights are adjusted in case of error
wi (new) wi (old ) txi
b(new) b(old ) t
• α is the learning rate, ‘t’ is the target which is -1 or 1.
• No error-no weight change-training is stopped
Single classification perceptron
network
Perceptron Training Algorithm for
Single Output Classes
Step 0: initialize weights, bias, learning rate( 0< <=1)
Step 1: perform step 2-6 until final stopping condition is false
Step 2: perform steps 3-5 for each bipolar or binary training pair indicated by s:t
Step 3: input layer is applied with identity activation fn:
xi=si
Step 4: calculate output response of each input j=1 to m
first, net input is calculated
activation are applied over the net input to calculate the output response.
Perceptron Training Algorithm for
Single Output Classes
Step 5: Make adjustment in weight and bias j=1 to m and i=1 to n
x1 X2 t
1 1 1
1 -1 -1
-1 1 -1
-1 -1 -1
• The perceptron network, which uses perceptron learning
rule, is used to train the AND function.
• The network architecture is as shown in Figure.
• The input patterns are presented to the network one by one.
When all the four input patterns are presented, then one
epoch is said to be completed.
• The initial weights and threshold are set to zero
W1 = W2. = b = 0 and ϴ= 0. The learning rate is set equal to=1.
• First input, (1,1,1) Calculate the net input yin
x1 x2 t
1 1 -1
1 -1 1
-1 1 -1
-1 -1 -1
NETWORK STRUCTURE
• S
1
b
w1 y
x1 X1 Y
w2
x2
X2
COMPUTATIONS
• Let us take w1 w2 0; 1, 0
b=0
First input: (1, 1, -1)
yin b x1w1 x2 w2 0 1 0 1 0 0
• The output using activation function is
1, if yin 0;
y f ( yin ) 0, if yin 0;
1, if y 0.
in
COMPUTATIONS
• So, output (y = 0) (t = -1)
• So weight updation is necessary
b(new) 0
x1 x2 b t yin y w1 w2 b
1 1 1 -1 0 0 -1 -1 -1
1 -1 1 1 -1 -1 0 -2 0
-1 1 1 -1 -2 -1 0 -2 0
-1 -1 1 -1 2 1 1 -1 -1
EXAMPLE
x1 x2 x3 x4 b t
1 1 1 1 1 1
-1 1 -1 -1 1 1
1 1 1 -1 1 -1
1 -1 -1 1 1 -1
COMPUTATIONS
• Here we take w1 w2 w3 w4 0,b=0, 0.2 . Also, 1
• The activation function is given by
1, if yin 0.2;
y 0, if yin -0.2 ≤ 𝑦𝑖𝑛 ≤ 0.2;
1, if y 0.2.
in
-1 1 -1 1 1 1 -1 -1 0 2 0 0 2
1 1 1 -1 1 -1 4 1 -1 1 -1 1 1
1 -1 -1 1 1 -1 1 1 -2 2 0 0 0
COMPUTATIONS
Input Target Net Out weights
Input put
EPOCH-2 x x4 b t Y in y w1 w2 w3 w4 b
x1 x2 3
1 1 1 1 1 1 0 0 -1 3 1 1 1
-1 1 -1 1 1 1 4 1 -1 3 1 1 1
1 1 1 -1 1 -1 5 1 -2 2 0 2 0
1 -1 -1 1 1 -1 -2 -1 -2 2 0 2 0
COMPUTATIONS
Input Target Net Out Weights
Input put
EPOCH-3 x x4 b t Y in y w1 w2 w3 w4 b
x1 x2 3
1 1 1 1 1 1 2 1 -2 2 0 2 0
-1 1 -1 1 1 1 6 1 -2 2 0 2 0
1 1 1 -1 1 -1 -2 -1 -2 2 0 2 0
1 -1 -1 1 1 -1 -2 -1 -2 2 0 2 0
Here the target outputs are equal to the actual outputs. So, we stop.
THE FINAL NET
• s
1
x1 b 0
X1
w1 2
x2 w2 2 Y y
X2
w3 0
x3
X3 w4 2
x4 X4
ADALINE Networks
Adaptive Linear Neuron (Adaline)
• A network with a single linear unit is called an ADALINE (ADAptive
LINear Neuron)
• Input-output relationship is linear
• It uses bipolar activation for its input signals and its target output
• Weights between the input and output are adjustable and has only
one output unit
• Trained using Delta rule (Least mean square) or (Widrow-Hoff rule)
Delta Rule
• Delta rule for Single output unit
– Minimize the error over all training patterns.
– Done by reducing the error for each pattern one at a time
• Delta rule for adjusting the weight for ith pattern is (i=1to n)
wi (t yin) xi
• Delta rule in case of several output units for adjusting the
weight from ith input unit to jth output unit
wij (t yinj ) xi
Adaline Model
x0=1
1
b
x1 w1
X1
yin= xiwi
f(yin)
w2
x2
X2 wn
yin
xn
Xn e=t-yin
Output error t
Adaptive
generator
algorithm
Adaline Training Algorithm
Step 0: Weights and bias are set to some random values other
than zero. Learning rate parameter α
Step 2: Perform steps 3-5 for each bipolar training pair s:t
Y
Initialize weights and
bias and α
If Ei=Es
Calculate error
Ei=Σ(t-yin)2
For
each wi (new) wi (old ) (t yin ) xi
s:t b(new) b(old ) (t yin )
x1 x2 1 t
1 1 1 1
1 -1 1 1
-1 1 1 1
-1 -1 1 -1
The initial weights are taken to be W1 = W2 =b = 0.1
A 1 bias 1 w01
bias t1
x1 X1 y1
Y1
vo1
Z1 yk t2
Xi Yk
x2
vij wjk
Zj
ym tm
Ym
xn Xn
Zp
Input Layer Hidden Layer Output Layer
BACK PROPOGATION NETWORK
Updation of weights.
FLOWCHART DESCRIPTION FOR TRAINING PROCESS
yk f (( yk )in ), k 1,2...m.
TRAINING ALGORITHM (BACK PROPAGATION OF ERROR)
Back-propagation of error (Phase II)
• STEP 6: Each output unit yk , k 1, 2...m receives a target
pattern to the input training pattern and computes the error
correction using:
k (tk yk ) f '(( yk )in )
Note : f ' ( yin ) f ( yin )[1 f ( yin )]
• STEP 7: Each hidden unit z j , j 1, 2...p sums its delta inputs
from the output units:
m
( )inj .kw jk
k =1
• The term ( )inj gets multiplied with the derivative of f ((z j )in )
to calculate the error term:
𝜹𝒋 = 𝜹𝒊𝒏𝒋 𝒇′ 𝒛𝒊𝒏𝒋
Update the changes in weight and bias
•
v ij . xi
j
v .j
oj
BPN TRAINING ALGORITHM
• STEP 0: Initialize the weights. (The weights are taken from the
training phase
• STEP 1: Perform steps from 2 – 4 for each input vector
• STEP 2: Set the activation of input for xi , I = 1,2,…n
• STEP 3: Calculate the net input to hidden unit z and its output
n
(z in ) j voj i 1
xi .vij and z j f ((zin ) j )
• STEP 4: Compute the net input and the output of the output
layer ( y ) w p z .w , y f (( y ) )
in k 0k j1 j jk k in k
•
• USE SIGMOIDAL FUNCTIONS AS ACTIVATION FUNCTIONS
EXAMPLE-1
• Using the Back propagation network, find the new weights
for the net shown below. It is presented with the input
pattern [0,1] and the target output 1. Use a learning rate of
0.25 and binary sigmoidal activation function.
1
0.3 1
0.2
0 0.6 0.5 0.4 y
X1 Z1 Y
0.3
0.1
1 0.1
X2 Z2
0.4
COMPUTATIONS
• The initial weights are:
v11 0.6, v21 0.1, v01 0.3
v12 0.3, v22 0.4, v02 0.5
w1 0.4, w2 0.1, w0 0.2
• The learning rate: 0.25 .
1
• The activation function is: Binary sigmoidal , i.e. f (x)
1 e x
Phase I :The feed-forward of the input training pattern
Calculate the net input , for hidden layer
• For z 1 ne uron :
(z1 )in v01 v11.x1 v21.x2 0.3 0 (0.6) 1 (0.1) 0.2
• For z2 neuron:
(z2 )in v02 v12 .x1 v22 .x2 0.5 0 (0.3) 1(0.4) 0.9
• Output:
(in ) j k .w jk
k 1
COMPUTATIONS CONTD…
• Initial Weights
• Learning rate
• Upgradation rule
−3 3
,
𝑜𝑖 𝑜𝑖
lead to overshooting
• Solution to this problem is to monitor the error on the test set and
terminates the training when the errors increases.
1 X2 Z2
v22 0.4
COMPUTATIONS
• Here, the activation function is the bipolar sigmoidal
activation function, that is
x
f (x) 1 e
x
• and 1 e
v11 0.6, v21 0.1, v01 0.3
v12 0.3, v22 0.4, v02 0.5
w1 0.4, w2 0.1, w0 0.2
• The input vector is [-1, 1] and target vector is t = 1
• Learning rate 0.25
COMPUTATIONS
• The net input:
• For z 1 neuron :
(z1 )in v01 v11.x1 v21.x2 0.3 (1) (0.6) 1(0.1) 0.4
• For z2 neuron:
(z2 )in v02 v12 .x1 v22 .x2 0.5 (1) (0.3) 1 (0.4) 1.2
• Outputs:
1 e( z1 )in 1 e0.4
z1 f ((z1 )in ) ( z1 )in 0.1974
0.4
• 1 e 1 e
1 e( z1 )in 1 e1.2
z2 f ((z2 )in ) ( z2 )in
1.2
0.537
1 e 1 e
COMPUTATIONS
• For output layer:
• Input:
yin w0 w1z1 w2z2 0.2 0.1974 0.4 0.537 0.1 0.22526
• Output
1 e yin 1 e 0.22526
y f ( yin ) 0.1122
y in 0.22526
1 e 1 e
COMPUTATIONS
• Error at the output neuron:
• We use the gradient descent formula: k (tk yk ) f ' (( yk )in )
f ' ( yin ) 0.5[1 f ( yin )][1 f ( yin )] 0.5[1 0.1122] [1 0.1122] 0.4937
So, m
(in ) j k .w jk
• k 1
COMPUTATIONS
• Here, m =1 (the output neuron). So, (in ) j 1.wj1
• Hence,
(in )1 1.w11 0.5491 0.4 0.21964
(in )2 1.w21 0.5491 0.1 0.05491
• Now,
f ' ((zin )1 ) 0.5 [1 f ((zin )1 )][1 f ((zin )1)] 0.5 (1 0.1974)(1 0.1974)
where x^ji; is the center of the RBF unit for input variables; σithe width of ith
RBF unit; xji the jth variable of input pattern.
Step 7:calculate the output of the neural network
• Hopfiled network
ASSOCIATIVE MEMORY NETWORK
The training input and target output vectors are the same
The determination of weights of the association net is called
storing of vectors
The vectors that have been stored can be retrieved from
distorted (noisy) input if the input is sufficiently similar to it
The net’s performance is based on its ability to reproduce a
stored pattern from a noisy input
NOTE: The weights in the diagonal can be set to ‘0’. These nets
are called auto-associative nets with no self-connection
ARCHITECTURE OF AUTOASSOCIATIVE
MEMORY NETWORK
x1 w11 y1
X1 Y1
wi1
wn1
w1i
xi yi
Xi wii Yi
wni
w1n
win
xn yn
Xn wnn Yn
TRAINING ALGORITHM
• This is same as that for the Hebb rule. Except that there are
same number of output units as the number of input units
• STEP 0: Initialize all the weights to ‘0’
• ( wij 0, i 1, 2,...n; j 1, 2,...n )
• STEP 1: For each of the vector that has to be stored, perform
• steps 2 to 4
• STEP 2: Activate each of the input unit ( xi si , i 1, 2,...n )
• STEP 3: Activate each of the output units (y j s j , j 1,2,...n )
• STEP 4: Adjust the weights, i, j = 1,2,…n;
wij (new) wij (old ) xi . y j wij (old ) si .s j
TESTING ALGORITHM
1 1 1 1 1
1 1 1 1 1
W . 1 1 1 1
1 1 1 1 1
1 1 1 1 1
• Case-1: testing the network with the same input vector
• Test input: [-1 1 1 1]
• The weight obtained above is used as the initial weights
---===c
COMPUTATIONS
1, if ( yin ) j 0;
y j f (( yin ) j )
1, if ( yin ) j 0.
• Over net input, we get
y = [-1 1 1 1]
• Hence, the correct response is obtained
COMPUTATIONS
1 1 1 1
1 1 1 1
( yin ) j x. W [0 111]. [ 3 3 3 3]
1 1 1 1
1 1 1 1
• Applying the activation function taken above, we get
• y = [-1 1 1 1]. So, the response is correct
COMPUTATIONS
1 1 1 1
1 1 1 1
( yin ) j x. W [1 111]. [ 2 2 2 2]
1 1 1 1
1 1 1 1
• Applying the activation function taken above
• y = [-1 1 1 1]
• So, the response is correct
COMPUTATIONS
1 1 1 1
1 1 1 1
( yin ) j x. W [ 1 0 0 1]. [ 2 2 2 2]
1 1 1 1
1 1 1 1
• NOTE: WE HAVE TO CHECK FOR ALL POSSIBLE INPUTS UNDER EACH CASE
TO HAVE A POSITIVE CONCLUSION
HETEROASSOCIATIVE MEMORY NETWORK
x1 w11 y1
X1 Y1
wi1
wn1
w1i
xi yi
Xi wii Yi
wni
w1m
wim
xn ym
Xn wnm Ym
1 𝑖𝑓 𝑦𝑖𝑛𝑗 ≥ 0
𝑦𝑖 =
0 𝑖𝑓 𝑦𝑖𝑛𝑗 < 0
EXAMPLE-HETEROASSOCIATIVE MEMORY
NETWORKS
• Train a heteroassociative memory network using Hebb rule to
store input row vector s1,s2,s3,s4 to the output vector
as given in the table below: t (t1 , t2 )
•
Input and targets s1 s2 s3 s4 t1 t2
1st 1 0 1 0 1 0
2nd 1 0 0 1 1 0
3rd 1 1 0 0 0 1
4th 0 0 1 1 0 1
THE NEURAL NET
• s
x1
X1 w11
y1
w12 Y1
x2 w21
X2 w22
w31
x3 w32 y2
X3 Y2
w41
x4 w42
X4
COMPUTATIONS
• The final weights after all the input/output vectors are used
are
w11 w12 2 1
w w22 0 1
W 21
w31 w32 1 1
w41 w42 1 1
Train the heteroassociative using outer product
rule – Another method
For 1 st pair . The input and output vector are s=1010, t=10
Train the heteroassociative using outer product
rule – Another method
W= =
EXAMPLE
Train a hetroassociative memory network to store the
input vector s=(s1,s2,s3,s4) to the output vector
t=(t1,t2). The vector pairs are given in table. Also the
test the performance of the network using its training
input as testing input.
Input and targets s1 s2 s3 s4 t1 t2
1st 1 0 0 0 0 1
2nd 1 1 0 0 0 1
3rd 0 0 0 1 1 0
4th 0 0 1 1 1 0
• Outer product rule is determine the weight
Layer X W Layer Y
x1 w11 y1
X1 Y1
wi1
wn1
w1i
xi yi
Xi wii Yi
wni
w1m
wim
xn ym
Xn wnm Ym
WT
BAM ARCHITECTURE
1, if (x in )i 0;
xi xi , if (x in )i 0;
0, if (x ) 0.
in i
E 1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1
F 1 1 1 1 1 1 1 -1 -1 1 -1 -1 1 -1 -1
E -1 1 W1
F 1 1 W2
COMPUTATIONS
W sT ( p). t ( p)
•
W2 [1 111111 1 11 1 11 1 1]T [11]
COMPUTATIONS
0 2
0 2
• The total weight matrix is
0 2
0 2
2 0
2 0
0 2
W W1 W2 2 0
2 0
0 +2
0 2
0 2
0 2
2 0
2 0
TESTING THE NETWORK
0 0 0 0 2 2 0 2 2 0 0 0 0 2 2
W
T
2 2 2 2 0 0 2 0 0 2 2 2 2 0 0
TESTING THE NETWORK
yxinin x. W T
0 0 0 0 2 2 0 2 2 0 0 0 0 2 2
[11]
2 2 2 2 0 0 2 0 0 2 2 2 2 0 0
xyinin 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
• Applying the activation functions, we get
xy 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 0 0 0 2 2 0 2 2 0 0 0 0 2 2
[11]
2 2 2 2 0 0 2 0 0 2 2 2 2 0 0
xinyin 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
Y1 Y2 Yi Yn
y1 y2 yi yn
TRAINING ALGORITHM FOR DISCRETE
HOPFIELD NETWORK
• STEP 0: Initialize the weights to store patterns, i. e. weights
obtained from training algorithm using Hebb rule
• STEP 1: When the activations of the net are not converged, perform
steps 2 - 8
• STEP 2: Perform steps 3 -7 for each input vector X
• STEP 3: Make the initial activation of the net equal to the external
input vector X (i. e. 𝑦𝑖 = 𝑥𝑖 (𝑖 = 1,2. . . 𝑛)
• STEP 4: Perform steps 5 – 7 for each unit 𝑌𝑖
update the activation of the unit in random order
• STEP 5: Calculate the net input of the network:
𝑦𝑖𝑛 𝑖 = 𝑥𝑖 + 𝑦𝑗 𝑤𝑗𝑖
𝑗
TRAINING ALGORITHM FOR DISCRETE
HOPFIELD NETWORK
• STEP 6: Apply the activations over the net input to calculate
the output:
1, if ( yin )i i ;
yi yi , if ( yin )i i ;
0, if ( y ) .
in i i