Professional Documents
Culture Documents
1. Neural Networks, Fuzzy Logic, and Genetic Algorithms : Synthesis and Applications,
Rajasekaran, S.; Vijayalakshmi Pai , G. A..
2. Internet Sources
Genetic
Algorithms (GA)
GA- FL
NN- GA
NN-FL-GA
Fuzzy Logic (FL)
NN- FL
Neural
Networks (NN)
Fundamentals of Neural Networks
What is Neural Net ?
• A neural net is an artificial representation of the human
brain tries that to simulate its learning process.
• An artificial neural network (ANN) is often called a "Neural
Network" or simply Neural Net (NN).
• Traditionally, the word neural network is referred to a
network of biological neurons in the nervous system that
process and transmit information.
• Artificial neural network is an interconnected group of
artificial neurons that uses a mathematical model or
computational model for information processing based on
a connectionist approach to computation.
• The artificial neural networks are made of
interconnecting artificial neurons which may share
some properties of biological neural networks.
• Artificial Neural network is a network of simple processing
elements (neurons) which can exhibit complex global
behavior, determined by the connections between the
processing elements and element parameters.
1. Introduction
Neural Computers mimic certain processing capabilities of the human
brain.
• Neural Computing is an information processing paradigm, inspired
by biological system, composed of a large number of highly
interconnected processing elements (neurons) working in unison to
solve specific problems.
f(Net or y or Sum)=
yin/ yin/
0 ℎ"#$ %"
Sum Sum)
w3
x3
Aggregation
Where
x1,x2…..,xN are binary input values
W1,W2……..,WN are weights associated with each input
Sum is the weighted sum of inputs;
And T is a predefined threshold value for the neuron activation
• Figure shows a graphical representation of the McCulloch-
Pitts artificial neuron.
• An input is considered excitatory when its contribution to
the weighted sum is positive, for instance x1*W1=1*1=1
• whereas an input is considered inhibitory when its
contribution to the weighted sum is negative, for instance
x1*W1=1*-1=-1.
• If the value of Sum is >= T, the neuron fires, otherwise, it
does not.
Let’s Take a real-world example:
A bank wants to decide if it can sanction a loan or not. There
are 2 parameters to decide- Salary and Credit Score. So there
can be 4 scenarios to assess-
1.High Salary and Good Credit Score
2.High Salary and Bad Credit Score
3.Low Salary and Good Credit Score
4.Low Salary and Bad Credit Score
• Let X1 = 1 denote high salary and X1 = 0 denote Low salary
and X2 = 1 denote good credit score and X2 = 0 denote bad
credit score
• Let the threshold value be 2. The truth table is as follows
Cont.….,
The truth table shows when the loan
should be approved considering all the
varying scenarios. X1 X2 X1+X Loan
2 appr
In this case, the loan is approved only if oved
the salary is high and the credit score is 1 1 2 1
good. 1 0 1 0
The McCulloch Pitt's model of neuron 0 1 1 0
was mankind’s first attempt at 0 0 0 0
mimicking the human brain.
And it was a fairly simple one too. It’s
no surprise it had many limitations-
1.The model failed to capture and compute cases of non-
binary inputs. It was limited by its ability to compute
every case with 0 and 1 only.
2.The threshold had to be decided before hand and
needed manual computation instead of the model deciding
itself.
3.Linearly separable functions couldn’t be computed.
McCulloch Pitt's model of neuron was implemented by
using
1.AND Function truth table
2.XOR Function truth table
3.ANDNOT Function truth table
1.Implement AND function using McCulloch–Pitts neuron
x1
The McCulloch-Pitts neuron was the earliest X1 W1=1
neural network discovered in 1943
It is usually called M-P neuron y
Since the firing of the Threshold ,the activation Y
function here is defend as
x2
X2 W2=1
f ( yin ) = { 1, if , yin ≥θ
0,if , yin <θ
X1
1
X2
1
Y
1
The threshold value should satisfy the following 1 0 0
condition
θ > nw − p 0 1 0
W11
Now find threshold value activation function X1 Z1 V1
Y
y
W21
if the θ=0 or 1, 3 or 2 neurons fire
X2 Z2
if the θ=2 then the last neuron is fires. W22 V2
Hence ,it is not possible to be obtain function Z1
using this weights of W11=W21=1
Case-1 cont…
First function
z1 = x1 x2
X1 X2 z
The truth table for function z 1
0 0 0
Assume the weights are Initialized to
0 1 0
W11=1 ; W21=-1
1 0 1
Calculate the net inputs,
( 0, 0 ) , z1in = 0 ×1 + 0 × −1 = 0 1 1 0
( 0,1) , z1in = 0 ×1 + 1× −1 = −1
(1, 0 ) , z1in = 1×1 + 0 × −1 = 1
(1,1) , z1in = 1×1 + 1× −1 = 0 W11
Now find threshold value activation function X1 Z1 V1
Y
y
W21
if the θ=0,-1 then the neuron is not fired.
X2 Z2
if the θ=1 then the neuron is fires. W22 V2
Hence W11=1 ; W21=-1
Case-2
Second function
X1 X2 z
z2 = x1 x2
0 0 0
( 0, 0 ) , z2in = 0 × −1 + 0 ×1 = 0
( 0,1) , z2in = 0 × −1 + 1×1 = 1
(1, 0 ) , z2in = 1× −1 + 0 ×1 = −1
(1,1) , z2in = 1× −1 + 1×1 = 0
Now find threshold value activation if the θ=0,-1 then the neuron is not fired.
function
if the θ=1 then the neuron is fires.
f ( yin ) = { 1,if , yin ≥θ
0,if , yin <θ Hence W12=-1 ; W22=1
Case-3
Third function X1 X2 y Z1 Z2
y=Z1 (OR) Z2
The truth table for function y 0 0 0 0 0
0 1 1 0 1
yin = z1v1 + z2 v2 1 0 1 1 0
Assume the weights are initialized to 1 1 0 0 0
v1 = v2 = 1
Calculate the net inputs, W11
X1
( 0, 0 ) , z2in = 0 × 1 + 0 × 1 = 0 X1 Z1 V1
From case-3
v1 = v2 = 1
X1 1
X1 Z1 1
-1
y
Y
X2 -1
X2 Z2
1 1
3.Implement ANDNOT function using McCulloch–Pitts neuron
X1 X2 Y
• Consider the truth table for ANDNOT
0 0 0
function.
0 1 0
• The M-P neuron has no particular
1 0 1
training algorithm.
1 1 0
• In M-P neuron ,only analysis is being
performed. (1,1 ) , y in = 1 × 1 + 1 × 1 = 2
• Hence, assume the weights be W1=1 (1, 0 ) , y in = 1 × 1 + 0 × 1 = 1
and W2=1. yin = x1w1 + x2 w2 ( 0,1 ) , y in = 0 × 1 + 1 × 1 = 1
• Calculate the net inputs, ( 0, 0 ) , y in = 0 ×1 + 0 ×1 = 0
X1
X1 W1=1
• Now find threshold value activation
function
Y y
f ( y in ) = { 1, if , y in ≥ θ
0 , if , y in < θ X2
X2 W2=1
Cont.….,
if the θ=0 or 2, the neurons are not fired as desired
if the θ=2 then the neuron is fires.
From the calculated net inputs, it is not possible to fire the neuron
for input(1,0) only. Hence ,these weights are not suitable. W1=W2=1
X(n)
Input vector
Z(n) y k (n) d k (n)
One or more layers of Output neuron
Σ
hidden neurons k
-
+
e k (n)
Where
Z(n): signal vector produced by hidden neurons
N: discrete time step of nitrative process involved in adjusting synaptic weights neuron k
yk(n):output signal of neuron k
dk(n):desired response/target output
error signal = desired response – output signal
e k (n) = d k (n) –y k (n)
Fig. signal-flow graph of output neuron
X 1 (n)
w k 1 (n)
X 2 (n)
w k 2 (n)
φ(.) -1 d k (n)
x(n)
w k j (n)
v k (n) y k (n)
X j (n)
e k (n)
w k m (n)
X m (n)
W1=W2=b=0
STEP-2:- First input vector is taken as [x1 x2 b]
= [1 1 1] and target value is 1
The new weights will be:
W(new)=w(old)+X*Y
W1(n)=W1(o)+X *Y=0+1*1=1
1
W2(n)=w2(o)+X2*Y=0+1*1=1
B(n)=b(o)+Y=0+1=1
The change in weights is :
∆W1=x1*Y=1;
∆W2=x2*Y=1
∆b=Y=1
STEP-3:- The above weights are the final new weights. When
the second input is passed, these become the initial weights.
STEP-4:- Take the second input = [1 -1 1]. The target is -1.
The weights vector is =[W1 W2 b] = [1 1 1]
The change is weights is: ∆W1=X1*Y=-1 ∆W2=X2*Y=1
∆b=Y=-1
The new weights will be W1(n)=W1+ ∆W1=> 1+(-1)=0
W2(n)=W2+ ∆W2=> 1+(1)=2
B(n)=b+ ∆b => 1+(-1)=0
STEP-5:- Similarly, the other inputs and weights are
calculated.
Cont.…,
STEP-6:- The table below shows all the input:
X1 X2 b y ∆W1 ∆w2 b W1 W2 b
1 1 1 1 1 1 1 1 1 1
1 -1 1 -1 -1 1 -1 0 2 0
-1 1 1 -1 1 -1 -1 1 1 -1
-1 -1 1 -1 1 1 -1 2 2 -2
X1 X1 2 Y
2
X2 X2
Hebb Net Solved Numerical Example-2
X1 X2 X3 X4 X5 X6 X7 X8 X9 b Y
I 1 1 1 -1 1 -1 1 1 1 1 1
O 1 1 1 1 -1 1 1 1 1 1 -1
Cont.…,
Set the initial weights and bias to ZERO, i.e.,
∆ w i = x i y , i = 1to 9
w1 =w2 =w3 =w4 =w5 =w6 =w7 =w8 =w9 =b=0 ∆ w 1 = x1 y = 1 × 1 = 1
Presenting first input pattern(I),we calculate change in
weights:
∆ w2 = x2 y = 1 × 1 = 1
wi (new) = wi (old ) + ∆wi ,sin ce[∆wi = xi y ] ∆ w3 = x3 y = 1 × 1 = 1
Setting the old weights as the initial weights here, we ∆ w4 = x4 y = − 1 × 1 = − 1
obtain
w i ( new ) = w i ( old ) + ∆ w i ∆ w5 = x5 y = 1 × 1 = 1
w1 ( new ) = w1 ( old ) + ∆ w1 = 0 + 1 = 1
∆ w6 = x6 y = − 1 × 1 = − 1
w 2 ( new ) = w 2 ( old ) + ∆ w 2 = 0 + 1 = 1
w 3 ( new ) = w 3 ( old ) + ∆ w 3 = 0 + 1 = 1 ∆ w7 = x7 y = 1 × 1 = 1
sim ilarly ∆ w8 = x8 y = 1 × 1 = 1
w 4 ( new ) = − 1, w 5 ( new ) = 1, w 6 ( new ) = − 1
w 7 ( new ) = 1, w8 ( new ) = 1, w 9 ( new ) = 1
∆ w9 = x9 y = 1 × 1 = 1
b ( new ) = 1 ∆b = y = 1
Cont...,
The weights after presenting first input pattern wi (new) = wi (old ) + ∆wi ,sin ce[∆wi = xi y ]
are
w1 = w2 = w3 = w7 = w8 = w9 = 1 w1 (new) = w1 (old ) + x1 y = 1 + 1× −1 = 0
w4 = w6 = −1
w2 (new) = w2 (old ) + x2 y = 1 + 1× −1 = 0
and , b = 1
These are the modify wights w3 (new) = w3 (old ) + x3 y = 1 + 1× −1 = 0
Presenting first input pattern(O),we calculate w4 (new) = w4 (old ) + x4 y = −1 + 1× −1 = −2
change in weights:
w5 (new) = w5 (old ) + x5 y = 1 + −1× −1 = 2
The weights after presenting first input pattern w6 (new) = w6 (old ) + x6 y = −1 + 1× −1 = −2
are
w1 = w2 = w3 = w7 = w8 = w9 = 0 w7 (new) = w7 (old ) + x7 y = 1 + 1× −1 = 0
w5 = 2 w8 (new) = w8 (old ) + x8 y = 1 + 1× −1 = 0
w4 = w6 = −2 w9 (new) = w9 (old ) + x9 y = 1 + 1× −1 = 0
and , b = 0
b(new) = b(old ) + y = 1 + 1× −1 = 0
Cont...,
To draw the finely Hebb Net work is
X1
X1
0
X2
X2 0
X3 0
X3
X4 0
X4 y
-2
X5 Y
2
X5
-2
X6
X6 0
X7 0
X7 0
X8
X8
X9 X9
Introduction, 1.2. Models of Neuron Network-Architectures
–Knowledge representation, Artificial Intelligence and
Neural networks–1.3. Learning process-Error correction
learning, Hebbian learning – Competitive learning-
Boltzman learning, supervised learning, Unsupervised
learning–Reinforcement learning-Learning tasks.
Competitive Learning
Unsupervised learning.
One neuron wins over all others
Only the winning neuron (or its close associates) learn.
Hard Learning – weight of only the winner is updated.
Soft Learning – weight of winner and close associates is updated.
A simple competitive network is basically composed of two
networks:
1.Hamming net - The Hamming net measures how much the input
vector resembles the weight vector of each perceptron.
2.Maxnet- The Maxnet finds the perceptron with the maximum value.
Each of them specializes in a different function.
• It is concerned with unsupervised training in which
the output nodes try to compete with each other to
represent the input pattern.
• To understand this learning rule we will have to
understand competitive net which is explained as
follows −
Basic Concept of Competitive Network:
• This network is just like a single layer feed-forward
• Network having feedback connection between the
outputs.
• The connections between the outputs are inhibitory
• type, which is shown by dotted lines, which means
the
• competitors never support themselves.
• Basic Concept of Competitive Learning Rule:
As said earlier, there would be competition among the
output nodes so the main concept is - during training,
the output unit that has the highest activation to a given
input pattern, will be declared the winner.
This rule is also called Winner-takes-all because only
the winning neuron is updated and the rest of the
neurons are left unchanged.
Mathematical Formulation
Following are the three important factors for mathematical
formulation of this learning rule −
Let a set of sensors all feed into three different nodes, so that
every node is connected to every sensor.
Let the weights that each node gives to its sensors be set
randomly between 0.0 and 1.0.
Let the output of each node be the sum of all its sensors,
each sensor's signal strength being multiplied by its weight.
It means that if any neuron, say, yk wants to win, then its
induced local field the output of the summation unit say vk,
must be the largest among all the other neurons in the
network. 1,if , vk > v j , forall , j , j ≠ k
yk = {.0,otherwise
Rule-2: Condition of the sum total of weight:
When the net is shown an input, the node with the highest
output is deemed the winner. The input is classified as being
within the cluster corresponding to that node.
Another constraint over the competitive learning rule is the
sum total of weights to a particular output neuron is going to
be 1.
For example, if we consider neuron k then
w
k
kj = 1, forall , k
Rule-3: Change of weight for the winner:
The winner updates each of its weights, moving weight from
the connections that gave it weaker signals to the connections
that gave it stronger signals.
= 0 .2 − 0 .1 = 0 .1
0 .1 0 .9
0 .2 0 . 7
W =
ij
0 .8 0 .5
0 .9 0 .3
Step3:- Calculate the induced outputs V1&V2 of O1 &O2 for input vector [ 1 0 0 0 ]
x1 x2 x3 x4
V1=0+1*0.2+1*0.8+0
V1=1
V2=0.60
Since V1>V2 ,
V1=0.45
V2=0.15
Since V1>V2 ,
X1
X1 W11
W12
V1 Y1
X2
W21 O1
X2
W22
X3 W31 Y2
X3 V2
W32 O2
W41
X4
W42
X4
Introduction, 1.2. Models of Neuron Network-Architectures
–Knowledge representation, Artificial Intelligence and
Neural networks–1.3. Learning process-Error correction
learning, Hebbian learning –Competitive learning-
Boltzman learning, supervised learning, Unsupervised
learning–Reinforcement learning-Learning tasks.
Boltzman learning
These are stochastic learning processes having
recurrent structure and are the basis of the early
optimization techniques used in ANN.
T new=0.95T old
training data, and on basis of that data, machines predict the output.
The labelled data means some input data is already tagged with the correct output.
In supervised learning, the training data provided to the machines work as the supervisor that teaches the
It applies the same concept as a student learns in the supervision of the teacher.
Supervised learning is a process of providing input data as well as correct output data to the machine
learning model.
The aim of a supervised learning algorithm is to find a mapping function to map the input variable(x) with
In the real-world, supervised learning can be used for Risk Assessment, Image classification, Fraud
3. Split the training dataset into training dataset, test dataset, and validation dataset.
4. Determine the input features of the training dataset, which should have enough knowledge so
5. Determine, such as support vector machine, decision tree, etc. the suitable algorithm for the
model
6. Execute the algorithm on the training dataset. Sometimes we need validation sets as the control
7. Evaluate the accuracy of the model by providing the test set. If the model predicts the correct
The working of Supervised learning can be easily understood by the below example and diagram:
Suppose we have a dataset of different types of shapes which includes
square, rectangle, triangle, and Polygon. Now the first step is that we
need to train the model for each shape.
If the given shape has four sides, and all the sides are equal, then it will
be labelled as a Square.
If the given shape has three sides, then it will be labelled as a triangle.
If the given shape has six equal sides then it will be labelled as hexagon.
Now, after training, we test our model using the test set, and the task
of the model is to identify the shape.
The machine is already trained on all types of shapes, and when it
finds a new shape, it classifies the shape on the bases of a number of
sides, and predicts the output.
Types of supervised Machine learning Algorithms:
Supervised learning can be further divided into two types of problems:
Here, we have taken an unlabeled input data, which means it is not categorized and
corresponding outputs are also not given.
Now, this unlabeled input data is fed to the machine learning model in order to train it.
Firstly, it will interpret the raw data to find the hidden patterns from the data and then will
apply suitable algorithms such as k-means clustering, Decision tree, etc.
Once it applies the suitable algorithm, the algorithm divides the data objects into groups according
to the similarities and difference between the objects
Types of Unsupervised Learning Algorithm:
The unsupervised learning algorithm can be further categorized into two types of problems:
An association rule is an
unsupervised learning
Clustering is a method
Unsupervised Learning method which is used for
of grouping the objects finding the relationships
into clusters such that between variables in the
objects with most large database.
similarities remains into It determines the set of
a group and has less or Clustering Association
items that occurs together
no similarities with the in the dataset.
objects of another Association rule makes
group. marketing strategy more
effective.
Cluster analysis finds
Such as people who buy
the commonalities X item (suppose a bread)
between the data are also tend to purchase
objects and categorizes Y (Butter/Jam) item.
them as per the A typical example of
presence and absence Association rule is Market
of those commonalities. Basket Analysis.
Unsupervised Learning algorithms
Below is the list of some popular unsupervised learning
algorithms:
K-means clustering
KNN (k-nearest neighbour's)
Hierarchal clustering
Anomaly detection
Neural Networks
Principle Component Analysis
Independent Component Analysis
Apriori algorithm
Singular value decomposition
Advantages and Disadvantages of
Unsupervised Learning
Advantages of Unsupervised Learning
Unsupervised learning is used for more complex
tasks as compared to supervised learning because,
in unsupervised learning, we don't have labeled
input data.
Unsupervised learning is preferable as it is easy to get
unlabeled data in comparison to labeled data.
Disadvantages of Unsupervised Learning
Unsupervised learning is intrinsically more
difficult than supervised learning as it does
not have corresponding output.
The result of the unsupervised learning
algorithm might be less accurate as input
data is not labeled, and algorithms do not
know the exact output in advance.
Difference between Supervised and Unsupervised Learning
Supervised Learning Unsupervised Learning
Supervised learning algorithms are trained using labeled data. Unsupervised learning algorithms are trained using unlabeled
data.
Supervised learning model takes direct feedback to check if it is Unsupervised learning model does not take any feedback.
predicting correct output or not.
Supervised learning model predicts the output. Unsupervised learning model finds the hidden patterns in data.
In supervised learning, input data is provided to the model along In unsupervised learning, only input data is provided to the
with the output. model.
The goal of supervised learning is to train the model so that it The goal of unsupervised learning is to find the hidden patterns
can predict the output when it is given new data. and useful insights from the unknown dataset.
Supervised learning needs supervision to train the model. Unsupervised learning does not need any supervision to train
the model.
Supervised learning can be categorized Unsupervised Learning can be classified
in Classification and Regression problems. in Clustering and Associations problems.
Supervised learning can be used for those cases where we know the Unsupervised learning can be used for those cases where we have
input as well as corresponding outputs. only input data and no corresponding output data.
Supervised learning model produces an accurate result. Unsupervised learning model may give less accurate result as
compared to supervised learning.
Supervised learning is not close to true Artificial intelligence as Unsupervised learning is more close to the true Artificial
in this, we first train the model for each data, and then only it can Intelligence as it learns similarly as a child learns daily routine
predict the correct output. things by his experiences.
It includes various algorithms such as Linear Regression, Logistic It includes various algorithms such as Clustering, KNN, and
Regression, Support Vector Machine, Multi-class Classification, Apriori algorithm.
Decision tree, Bayesian Logic, etc.
Introduction, 1.2. Models of Neuron Network-Architectures
–Knowledge representation, Artificial Intelligence and
Neural networks–1.3. Learning process-Error correction
learning, Hebbian learning –Competitive learning- Boltzman
learning, supervised learning, Unsupervised learning–
Reinforcement learning- Learning tasks.
Reinforcement Learning
Reinforcement Learning is defined as a Machine Learning method that is concerned with how
Reinforcement Learning is a part of the deep learning method that helps you to maximize
This neural network learning method helps you to learn how to attain a complex objective
In general, a reinforcement learning agent is able to perceive and interpret its environment,
mechanism.
As cat doesn’t understand English or any other human language, we can’t tell her directly what
We emulate a situation, and the cat tries to respond in many different ways. If the cat’s response
Now whenever the cat is exposed to the same situation, the cat executes a similar action with
That’s like learning that cat gets from “what to do” from positive experiences.
At the same time, the cat also learns what not do when faced with negative experiences.
Example of Reinforcement Learning
In this case,
Your cat is an agent that is exposed to the
environment. In this case, it is your house. An
example of a state could be your cat sitting, and
you use a specific word in for cat to walk.
Our agent reacts by performing an action
transition from one “state” to another “state.”
For example, your cat goes from sitting to
walking.
The reaction of an agent is an action, and the
policy is a method of selecting an action given a
state in expectation of better outcomes. How Reinforcement Learning works
After the transition, they may get a reward or
penalty in return.
Reinforcement Learning Algorithms
There are three approaches to implement a Reinforcement Learning algorithm.
Value-Based:
In a value-based Reinforcement Learning method, you should try to maximize a value function V(s).
In this method, the agent is expecting a long-term return of the current states under policy π.
Policy-based:
In a policy-based RL method, you try to come up with such a policy that the action performed in
every state helps you to gain maximum reward in the future.
Two types of policy-based methods are:
•Deterministic: For any state, the same action is produced by the policy π.
•Stochastic: Every action has a certain probability, which is determined by the following equation.
Stochastic Policy : n{a\s) = P\A, = a\S, =S]
Model-Based:
In this Reinforcement Learning method, you need to create a virtual model for each environment.
The agent learns to perform in that specific environment.
Characteristics of Reinforcement Learning
Function Pattern
regression recognition
Data sets
Function regression
Function regression is the most popular learning task for
neural networks.
It is also called modelling.
The function regression problem can be regarded as the
problem of approximating a function from a data set
consisting of input-target instances.
The targets are a specification of what the response to the
inputs should be.
While input variables might be quantitative or qualitative,
in function regression, target variables are quantitative.
• Loss indices for function regression are usually based on a
sum of errors between the outputs from the neural
network and the targets in the training data.
• As the training data is usually deficient, a regularization
term might be required to solve the problem correctly.
• An example is to design an instrument that can determine
serum cholesterol levels from measurements of the spectral
content of a blood sample.
• There are a number of patients for which there are
measurements of several wavelengths of the spectrum.
• For the same patients, there are also measurements of
several cholesterol levels based on serum separation.
Pattern recognition
The learning task of pattern recognition gives rise to
artificial intelligence.
That problem can be stated as the process whereby a received
pattern, characterized by a distinct set of features, is
assigned to one of a prescribed number of classes.
Pattern recognition is also known as classification.
Here the neural network learns from knowledge represented
by a training data set consisting of input-target instances.
The inputs include a set of features that characterize a
pattern, and they can be quantitative or qualitative.
• The targets specify the class that each pattern belongs to and
therefore are qualitative.
• We can formulate classification problems can be formulated as being
modelling problems.
• As a consequence, the loss index used here is also based on the sum
squared error.
• Anyway, the learning task of pattern recognition is more challenging
to solve than that of function regression.
• This means that a good knowledge of the state of the technique is
recommended for success.
• A typical example is to distinguish hand-written versions of
characters.
• Images of the characters might be captured and fed to a computer.
• An algorithm then seeks to which can distinguish as reliably as
possible between the characters.
Perceptron Learning
Perceptron Learning
In Machine Learning and Artificial Intelligence, Perceptron is the most commonly used term for
all folks.
It is the primary step to learn Machine Learning and Deep Learning technologies, which consists
Initially, in the mid of 19th century, Mr. Frank Rosenblatt invented the Perceptron for performing
Perceptron is a linear Machine Learning algorithm used for supervised learning for various
binary classifiers.
This algorithm enables neurons to learn elements and processes them one by one during
preparation.
What is Perceptron?
A perceptron network is a group of simple logical statements that come together to create
It produces binary outputs from input values while taking into consideration weights and
threshold values.
Perceptron Networks are single-layer feed-forward networks. These are also called Single
Perceptron Networks.
The Perceptron consists of an input layer, a hidden layer, and output layer.
The input layer is connected to the hidden layer through weights which may be inhibitory
or exciters or zero (-1, +1 or 0).
The activation function used is a binary step function for the input layer and the
hidden layer.
The output is
Y= f (y)
The activation function is:
1, if , y ≥ threshold
F ( y ) = 0, if − ( threshold ) ≤ y ≤ threshold
−1, if , y < −(threshold )
The weight updation takes place between the hidden layer and the output layer to match
the target output.
The error is calculated based on the actual output and the desired output
W(new)=w(old)+ α*t*x
B(new)=b(old)+ α*t
If the output matches the target then no weight updation takes place.
The weights are initially set to 0 or 1 and adjusted successively till an optimal solution is found.
The weights in the network can be set to any values initially.
The Perceptron learning will converge to weight vector that gives correct output for all input
training pattern and this learning happens in a finite number of steps.
The Perceptron rule can be used for both binary and bipolar inputs.
Learning Rule for Single Output Perceptron
1. Let there be “n” training input vectors and x (n) and t (n) are associated with the target values.
2. Initialize the weights and bias. Set them to zero for easy calculation.
3. Let the learning rate be 1.
4. The input layer has identity activation function so x (i)= s ( i).
5. To calculate the output of the network:
Y=b+ ΣX*W for all input vectors from 1to n.
6.The activation function is applied over the net input to obtain an output.
1, if , y ≥ threshold
F ( y ) = 0, if − ( threshold ) ≤ y ≤ threshold
−1, if , y < −(threshold )
7.Now based on the output, compare the desired target value (t) and the actual output.
if y ≠ t then weight updating takes place
W(n)=w(o)+α*x
B(n)=b(o)+ α*t
if y=t then
W(n)=w(o)
B(n)=b(o)
8. Continue the iteration until there is no weight change. Stop once this condition is
achieved.
Learning Rule for Multiple Output Perceptron
1. Let there be “n” training input vectors and x (n) and t (n) are associated with the target values.
2. Initialize the weights and bias. Set them to zero for easy calculation.
3. Let the learning rate be 1.
4. The input layer has identity activation function so x (i)= s ( i).
5. To calculate the output of each output vector from j= 1 to m, the net input is:
Y=b+ ΣX*W for all input vectors from 1to n for every j.
6.The activation function is applied over the net input to obtain an output.
1, if , y ≥ threshold
F ( y ) = 0, if − ( threshold ) ≤ y ≤ threshold
−1, if , y < −(threshold )
7.Now based on the output, compare the desired target value (t) and the actual output and make weight
adjustments.
if y ≠ t then weight updating takes place
W(n)=w(o)+α*t*x
B(n)=b(o)+ α*t
if y=t then
W(n)=w(o)
B(n)=b(o)
where w is the weight vector of the connection links between ith input and jth output neuron and t is the target
output for the output unit j.
8.Continue the iteration until there is no weight change. Stop once this condition is achieved.
Examples Of Perceptron Learning Rule
Implementation of OR function using a Perceptron network for bipolar inputs and output.
The input pattern will be A, B. Let the initial weights be W1=0.6,W2=0.6. The threshold is set to
1 and the learning rate is n=0.5.
Case-1: A=0,B=0 and Target=0 A B Y=A+B
Wi.Xi = 0*0.6+0*0.6 = 0 0 0 0
This is not greater than the threshold of 1,so the output=0 (since Target=Output) 0 1 1
Case-2: A=0,B=1 and Target=1 1 0 1
Wi.Xi = x1w1+x2w2 = 0*0.6+1*0.6 = 0.6 1 1 0
This is not greater than the threshold of 1,so the output=0(since Target ≠Output)
Modified weights
Wi=wi+n(t-o)xi
W1=0.6+0.5(1-0)0 = 0.6
W2=0.6+0.5(1-0)1= 1.1
Check :
From Case-1 wi.xi=0*0.6+0*1.1 = 0 (since Target=Output)
From case-2 wi.xi=0*0.6+1*1.1 =1.1
This is greater than the threshold of 1,so the output=1(since Target =Output)
Case-3: A=1,B=0 and Target=1
Wi.xi=1*0.6+0*1.1= 0.6
This is not greater than the threshold of 1,so the output=0 (since Target ≠Output)
Modified weights
Wi= wi + n(t-o)xi
W1=0.6 + 0.5(1-0)1 =1.1
W2=1.1 + 0.5(1-0)1= 1.1
Check :
From case-1: wi.xi = 0*1.1 + 0*1.1 = 0
This is not greater than the threshold of 1,so the output=0 (since Target=Output)
From case-2: wi.xi = 0*1.1 + 1*1.1 = 1.1
This is greater than the threshold of 1,so the output=1 (since Target =Output)
From case-3: wi.xi=1*1.1 + 0*1.1= 1.1
This is greater than the threshold of 1,so the output=1(since Target =Output)
Case-4: A=1,B=1 and Target=1
Wi.xi=1*1.1+1*1.1= 2.2
This is greater than the threshold of 1,so the output=1(since Target =Output)
Network draw
1.1
Weighted sum
Output
Σ Θ=1
1.1
B
Thank You