SC - M1 - Ktunotes - in
SC - M1 - Ktunotes - in
Page 2
Module 1:
► Genetic Algorithms
Evolution of Soft Computing
Problem Solving Methodologies
► Soft computing
► Well suited for real world problems where ideal models are not available
Problem Solving Methodologies
soft computing
► The term soft computing was introduced by Prof.Lotfi Zadeh. (1994),University
of California,Berkeley ,USA
► Goal
► To emulate the human mind as closely as possible
► Partnership with many fields
► Neural network
► Genetic Algorithm
► Fuzzy Logic
Hard computing
► In 1996, L. A. Zadeh (LAZ) introduced the term hard computing.
► According to LAZ: We term a computing as Hard computing,
► Characteristics of hard computing
► Precise result is guaranteed.
► Control action is unambiguous.
► Control action is formally defined (i.e., with mathematical model or algorithm)..
► Examples of hard computing
► Solving numerical problems (e.g., roots of polynomials, integration, etc.).
► Searching and sorting techniques.
► Solving computational geometry problems (e.g., shortest tour in a graph, finding closet pair
of points given a set of points, etc.).
Soft computing
► The term soft computing was proposed by the inventor of fuzzy logic, Lotfi A.
Zadeh
► Definition 1:
► Soft computing Soft computing is a collection of methodologies that aim to exploit the
tolerance for imprecision and uncertainty to achieve tractability, robustness, and low
solution cost. Its principal constituents are fuzzy logic, neurocomputing, and probabilistic
reasoning.
► The role model for soft computing is the human mind
► Characteristics of soft computing
► It does not require any mathematical modeling of problem solving.
► It may not yield the precise solution.
► Algorithms are adaptive (i.e., it can adjust to the change of dynamic environment).
► Use some biological inspired methodologies such as genetics, evolution, Ant’s behaviors,
particles swarming, human nervous system, etc.).
Soft computing
► There are three types of soft computing techniques which include the
following.
► Artificial Neural Network
► Fuzzy Logic
► Genetic algorithm
► Artificial Neural Network
►
Soft computing
► Examples of soft computing-fuzzy logic
Page 27 Prof.Smitha Jacob, Department of Computer Science and Engineering, SJCET Palai
Biological Neurons
► A neuron is the basic processing unit in a neural network sitting on our
brain.
► It consists of
► Soma or cell body where cell nucleus is situated
► Dendrites –Tree like network made of nerve fibre connected to cell body
which receives signals
► Axon-Single long connection extending from the cell body which carries
impulses of the neuron and transmit signals
► Synapse –The end of the axon splits into fine strands, each strand
terminates into a small bulb like organ called Synapse.
► There are approximately 104 synapses/neurons in human brain.There are
1015 synaptic connection are there in human brain
Biological Neurons
► Neuron collects signals from dendrites.
► Sends out spikes of electrical activity through an axon, which splits into
thousands of branches.
► Electric pulses are passed between the synapse and the dendrites
► At the end, a synapses converts activity into either excitatory or inhibiting
activity of a dendrite at another neuron.
► Neuron fires during an excitatory activity and surpasses inhibitory activity
► If the electrical potential inside the body of the receiving cell reaches a
threshold, then the receiving cell fires and pulse or action of fixed strength
and duration is sent out through the axon to the synaptic junctions of the
other cell.
► After firing the cell has to wait for a period called refractory period before it
can fire again.
Biological Neurons
Artificial Neural Network
► ANN is an efficient Information processing paradigm which resembles the
characteristics of a biological neural network.
► ANN is composed of large number of interconnected processing elements
called neurons connected by synapses which operates in parallel
► Each neuron is connected with the other by a connection link.
► Each connection link is associated with weights which contain information about
the input signal.
► This information is used by the neurons net to solve a particular problem
► Each neuron has an individual state of its own. This state can be varied based on
the activation signal.
► The activation signal of a neuron is transmitted to other neurons
► A neuron can send only one signal at a time ,which can be transmitted to other neurons.
Artificial Neural Network
Page 46 Prof.Smitha Jacob, Department of Computer Science and Engineering, SJCET Palai
Basic models of
Artificial Neural Networks
Basic models of artificial neural networks
► The models of Artificial neural network is characterized by three basic
entities namely
1. connections between the neurons called its architecture
2. training or learning rules adopted for updating and
adjusting weights on the connections
3. Its internal state called its Activation function.
► The arrangement of neurons into layers and the connection patterns within
and between layers is called the net architecture
Connections
1.Connections
► An ANN consists of set of highly interconnected processing
elements(Neurons)
► The point where the connection originates and terminated should be noted
and functions of each processing element of an ANN is specified.
► Connection means the network topology ,which is the arrangement of a
network along with its nodes and connecting lines.
► There are five types of Neural Network Connections
► Single layer feed forward network
► An error signal is generated if there is a difference between the actual output and
the desired/target output vector. On the basis of this error signal, the weights
would be adjusted until the actual output is matched with the desired output.
► In ANN each input vector requires a corresponding target vector ,which represents
the desired output.The i/p vector along with target vector is called Training Pair.
Reinforcement Learning
► Similar to supervised learning. But only critic information available.
► In reinforcement learning the learning is based on critic information
and the feedback sent is known as Reinforcement signal.
► The network receives some feedback from the environment.
2.Learning
Reinforcement Learning
► The ANN makes a decision by observing its environment.
► If the observation is negative, the network adjusts its weights to be able
to make a different required decision the next time..
► Examples include a robot in a unknown terrain where its get a
punishment when its hits an obstacle and reward when it moves
smoothly.
► It is a trial and error method.
► Reinforcement learning is about an autonomous agent taking suitable
actions to maximize rewards in a particular environment. Over time, the
agent learns from its experiences and tries to adopt the best
possible behavior.
► In the case of reinforcement learning, we limit human interaction to
changing the environment states, and the system of rewards and
penalties. This setup is known as the Markov Decision Process
2.Learning Reinforcement Learning
► In ANN activation function may be defined as the extra force or effort applied over the
net input to obtain an exact output.Activation function is applied over the net input to
calculate the o/p of the ANN
► An Activation Function decides whether a neuron should be activated or not by
calculating weighted sum and further adding bias with it..
► This means that it will decide whether the neuron’s input to the network is important or
not in the process of prediction using simpler mathematical operations.
► Linear and Non linear activation functions can be used to generate the neurons
response.
► Linear
► Identity functions
► Binary Step Function
► Bipolar step functions
► Non Linear
► Sigmoid Function
► Ramp Function
3.Activation Function
► It cannot provide multi-value outputs so, it cannot be used for multi-class classification
problems.
► The gradient of the step function is zero, which causes a hindrance in the backpropagation
3.Activation Function
► In the Bipolar Step Function, if the value of Y is above a certain value known as the
threshold, the output is +1and if it’s less than the threshold then the output is -1.
► It has bipolar outputs (+1 to -1). It can be utilized in single-layer networks.
3.Activation function
4.Sigmoidal Functions
► A sigmoidal function is a mathematical function having a characteristic "S"-shaped curve or
sigmoid curve.
► When the activation function for a neuron is a sigmoid function it is a guarantee that the
output of this unit will always be between 0 and 1.
► Also, as the sigmoid is a non-linear function, the output of this unit would be a non-linear
function of the weighted sum of inputs.
► This function takes any real value as input and outputs values in the range of 0 to 1.
► The larger the input (more positive), the closer the output value will be to 1.0, whereas the
smaller the input (more negative), the closer the output will be to 0.0
► They are widely used in backpropagation networks because of the relationship between the
value of the functions at a point and the value of the derivative at that point which reduces
the computational burden during training.
► Sigmoidal functions are of two types
► Binary Sigmoidal Function
► Bipolar Sigmoidal function
3.Activation function
Sigmoidal Functions
3.Activation Function
• ReLu stands for the rectified linear unit (ReLU). It is the most used activation function in
the world. It output 0 for negative values of x. This is also known as a ramp function..
• The name of the ramp function is derived from the appearance of its graph.
• ReLu(Rectified Linear Unit) is like a linearity switch. If you don’t need it, you “switch” it off.
If you need it, you “switch” it on.
• ReLu also provides the benefit of sparsity and sigmoids result in dense representations.
Sparse representations are more useful than dense representations.
Problems
Q1 :Activation Function
Obtain the output of the neuron Y for the network shown in Figure using the
following activation functions
i)Binary Sigmoidal
ii)Bipolar sigmoidal
Q1 :Activation Function
Q1 :Activation Function
Q1 :Activation Function
Q2 :Activation Function
► Calculate the net o/p of the NN using the bipolar and binary sigmoidal
activation function
Q1 :Activation Function
Q1 :Activation Function
Q3 :Activation Function
► Construct a feed forward network with 4 input nodes,2 hidden nodes and
3 o/p nodes
Q4 :Activation Function [Univ ques January 2022]
► Calculate the net input to the neuron Y for the network shown in figure.
Compute output of the neuron Y using binary sigmoidal activation
function.
► For inhibition to be absolute ,the threshold with the activation function should satisfy
the following condition.
► Where n→no of neurons , w→ weight of excitatory connections , p→ weight of
inhibitory connections
► The o/p will fire if it contains ‘k’ or more excitatory inputs but no inhibitory inputs where
Architecture of McCulloch and Pitts Neuron
Page 110 Prof.Smitha Jacob, Department of Computer Science and Engineering, SJCET Palai
Implement AND NOT function using M-P Neuron Model(Use Binary Data)
Implement NOT function using M-P
Neuron Model(with one input)
Implement NOT gate function using M-P Neuron Model
(with one input x1)
Implement NOT gate function using M-P Neuron Model
(with one input x1)
Page 115 Prof.Smitha Jacob, Department of Computer Science and Engineering, SJCET Palai
Implement NOT gate function using M-P Neuron Model
(with one input x1)
Implement OR function using M-P
Neuron Model(Use Binary Data)
Implement OR gate function using M-P Neuron Model(with binary data)
Page 118 Prof.Smitha Jacob, Department of Computer Science and Engineering, SJCET Palai
Implement OR gate function using M-P Neuron Model(with binary data)
Implement OR gate function using M-P Neuron Model(with binary data)
kw=2*1=2
(k-1)w=(2-1)*1=1
Implement NAND function using M-P
Neuron Model(Use Binary Data)
Implement NAND(NOT-AND) gate function using M-P Neuron Model(with
binary input
Implement NAND(NOT-AND) gate function using M-P Neuron Model(with
binary input
Implement NAND(NOT-AND) gate function using M-P Neuron Model(with
binary input
Implement NAND(NOT-AND) gate function using M-P Neuron Model(with
binary input
Implement NAND(NOT-AND) gate function using M-P Neuron Model(with
binary input
Implement NAND(NOT-AND) gate function using M-P Neuron Model
(with binary input)
► =2*0-1
► =-1
Implement XOR function using M-P
Neuron Model(Use Binary Data)
Implement XOR gate function using M-P Neuron Model
(with binary input)
Implement XOR gate function using M-P Neuron Model
(with binary input)
Implement XOR gate function using M-P Neuron Model
(with binary input)
Implement XOR gate function using M-P Neuron Model
(with binary input)
Implement XOR gate function using M-P Neuron Model
(with binary input)
Implement XOR gate function using M-P Neuron Model
(with binary input)
Implement XOR gate function using M-P Neuron Model
(with binary input)
McCulloch and Pitts Neuron Conclusion
► In 1949, Donald Hebb proposed one of the key ideas in biological learning,
commonly known as Hebb’s Law.
► Hebb introduced a neurophysiological postulate :
“…When an axon of cell A is near enough to excite a cell B
and repeatedly and persistently takes part in firing it, some growth
process or metabolic change takes place in one or both cells, such that
A’s efficiency as one of the cells firing B, is increased.”
► Hebb’s Law states that if neuron i is near enough to excite neuron j and
repeatedly participates in its activation, the synaptic connection between
these two neurons is strengthened and neuron j becomes more sensitive to
stimuli from neuron i
Hebb Network
► basically the above explanation is derived from the modus operandi (the way in
which something operates or works)used by the brain where learning is
performed by the changes in the synaptic gap
► In this, if 2 interconnected neurons are ON simultaneously then the weight
associated with these neurons can be increased by the modification made in
their synaptic gaps(strength).
► Hebb’s Law can be represented in the form of two rules:
► If two neurons on either side of a connection are activated synchronously,
then the weight of that connection is increased.
► If two neurons on either side of a connection are activated asynchronously,
then the weight of that connection is decreased.
► Hebb’s Law provides the basis for learning without a teacher.
► Learning here is a local phenomenon occurring without feedback from the
environment.
► It is a kind of feed-forward, unsupervised learning.
Hebbian learning in a neural network
Output Signals
Input Signals
i j
Hebb Network
► Hebb learning rule,is the oldest and simplest ANN rules, was introduced
by Donald Hebb in his book The Organization of Behavior in 1949.
► It is more suited for bipolar data than binary data
► From the postulate , we may conclude that the connections between two
neurons might be strengthened if the neurons fire at the same time and
might weaken if they fire at different times.
► Hebb Rule states that “the weight vector is found to increase
proportionately to the product of the input signal and the learning
signal(o/p signal)”
► ANN learning rule defines how to adjust the weights of connections to
get desirable output
► The process of adjusting the weight is known as Learning.
► The procedure to incrementally update each of weights in neural is based
on Training algorithm & Learning law
Hebb Network
Hebb Network
Hebb Network Flowchart& Algorithm
Hebb Network-Training Algorithm
Hebb Network Problem
Hebb Network -logical AND function
Design a Hebb Network to implement logical AND function .Use
bipolar i/p and targets
► AND function is very simple
and mostly known to everyone
where the output
is 1/SET/ON if both the inputs
are 1/SET/ON.
► But in this example, we have
used ‘-1' instead of ‘0’ this is
because the Hebb network
uses bipolar data and not
binary data because the
product item in the above
equations would give the
output as 0 which leads to a
wrong calculation.
Design a Hebb Network to implement logical AND function .Use
bipolar i/p and targets
► Step 1: Initially the weight and bias as set as Zero. w1=w2=b=0
► Step2 :First input[x1 x2 b]=[1 1 1] target y=1.
Setting the initial weight as old weight and applying the Hebb Rule.
((w1(old)=0, w2(old)=0, b(old)=0))
Design a Hebb Network to implement logical AND function .Use
bipolar i/p and targets
► The above calculated weights are used as the initial weight when second
pattern is considered.
► Weight change here is
Design a Hebb Network to implement logical AND function .Use
bipolar i/p and targets
► Second input[x1 x2 b]=[1 -1 1] target y=-1.
Setting the initial weight as old weight and applying the Hebb Rule.
((w1(old)=1, w2(old)=1, b(old)=1))
► The weight changes here are:
Design a Hebb Network to implement logical AND function .Use
bipolar i/p and targets
Palai
Hebb Network -logical OR function
Design a Hebb Network to implement logical OR function
Use bipolar i/p and targets
Design a Hebb Network to implement logical OR function
Use bipolar i/p and targets
Design a Hebb Network to implement logical OR function
Use bipolar i/p and targets
Design a Hebb Network to implement logical OR function
Use bipolar i/p and targets
Palai
Design a Hebb Network to implement logical OR function
Use bipolar i/p and targets
► For third input
Design a Hebb Network to implement logical OR function
Use bipolar i/p and targets
► For fourth input
Design a Hebb Network to implement logical OR function
Use bipolar i/p and targets
Hebb Network -logical XOR function
Design a Hebb Network to implement XOR function .Use bipolar i/p
and targets
Design a Hebb Network to implement XOR function .Use bipolar i/p
and targets
Design a Hebb Network to implement XOR function .Use bipolar i/p
and targets
Design a Hebb Network to implement XOR function .Use bipolar i/p
and targets
Design a Hebb Network to implement XOR function .Use bipolar i/p
and targets
Design a Hebb Network to implement XOR function .Use bipolar i/p
and targets
► The final weights obtained after presenting all i/p functions do not give the
correct o/p for all patterns
► Thus XOR function is a special case of Pattern classification problem
which is not linearly separable.
► It can be made linear separable by separating +ve regions and –ve Regions
Hebb Network -problem
Using Hebb Network calculate the weight required to perform the
following classification of given i/p pattern
I o
I o
Using Hebb Network calculate the weight required to perform the
following classification of given i/p pattern
► Here a single-layer network with nine input neurons, one bias and one
output neuron is formed.
► Set the initial weights and bias to zero, i.e.,
w1=w2=w3=w4=w5=w6=w7=w8=w9= 0
► Case 1: Presenting first input pattern (I), we calculate change in weights:
Using Hebb Network calculate the weight required to perform the
following classification of given i/p pattern
Using Hebb Network calculate the weight required to perform the
following classification of given i/p pattern
Using Hebb Network calculate the weight required to perform the
following classification of given i/p pattern
Using Hebb Network calculate the weight required to perform the
following classification of given i/p pattern
Using Hebb Network calculate the weight required to perform the
following classification of given i/p pattern
Hebb Network –tutorial questions
1.Using Hebb Network calculate the weight required to perform the
following classification of given i/p pattern
► Using Hebb Network calculate the weight required to perform the
following classification of given i/p pattern.
► L →belongs to the members of the class(+)→target value 1
► U→does not belongs to members of class(.)→target value -1
2.Using Hebb Network calculate the weight required to perform the
following classification of given i/p pattern
3.Using Hebb Network calculate the weight required to perform the
following classification of given i/p pattern
► Using Hebb rule find weights required to perform following classifications.
The vectors(1 -1 1 -1 ) and (1 1 1 -1) belongs to class (target value +1);
vectors (-1 -1 1 1) and(1 1 -1 -1) do not belongs to class( target value -1).
Also using each of training x vectors as input, test the response of the net
Linear Separability
Linear separability
► Linear separability is the concept wherein , the separation of input space into
regions is based on whether the network response is positive or negative.
► Linear separable means ,in the plane if we can splits the input data into two half-
spaces such that all points of the first class should be in one half-space and other
points of the second class should be in the other half-space.
► In two dimensional space, it means that there is a line, which separates points of
one class from points of the other class.
► The idea of linearly separable is easiest to visualize and understand in 2 dimensions
Linear separability