=thete
yG)el;
else
yQ)
end
end
disp( ‘Output of Net’):
disp(‘Net is not learning enter another set of weights and Threshold value’):
wl=input(‘weight wi=" ):
w2=input (‘weight w2="):
theta=input('theta="
end
end
disp(*MccuTloch-Pitts Net for ANDNOT function’ ):
disp( ‘Weights of Neuron’):
dispiwl):
dispiw2);
disp(‘Threshold value’
disp(theta);
Elgments sous droits d'euteuraa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.44 Introduction to Neural Networks
‘This type of synapse is called Hebbian synapse. The fourkey mechanisms that characterize a Hebbian
synapse are time dependent mechanism, local mechanism, interactive mechanism and correlational
mechanism.
The simplest form of Hebbian leaming is described by,
Aw=x,y
‘This Hebbian learning rule represents a purely feed forward, unsupervised learning. It states that if
the cross product of output and input is positive, this results in increase of weight, otherwise the weight
decreases.
In some cases, the Hebbian rule needs to be modified to counteract unconstrained growth of weight
values, which takes place when excitations and response consistently agree in sign. This corresponds to
the Hebbian learning rule with saturation of weights at a certain preset level.
3.3.2 Perceptron Learning Rule
For the perceptron learning rule, the learning signal is the difference between the desired and actual
neuron’s response. This type of learning is supervised.
The fact that the weight vector is perpendicular to the plane separating the input patterns during the
learning processes, can be used to interpret the degree of difficulty of training a perceptron for different
types of input.
‘The perceptron leaming rule states that for a finite ‘n’ number of input training vectors,
x(n) where n=110N
each with an associated target value,
tin) where n= 110N
which is +1 or - 1, and an activation function y — f(y_,,), where,
1 if y>o
y=40 if -0sy,s0
Hl if ¥j,<-8
the weight updation is given by
ify #t, then
Waew = Wor +
ify =, then there is no change in weights.
‘The perceptron learning rule is of central importance for supervised learning of neural networks. The
weights can be initialized at any values in this method.
There is a perceptron learning rule convergence theorem which states, “If there is a weight vector w*
such that f(x(p) w*) = t(p) for all p, then for any starting vector w, the perceptron learning rule will
converge toa weight vector that gives the correct response for all training patterns, and this will be done
in a finite number of steps”.
3.3.3 Delta Learning Rule (Widrow-Hoff Rule or Least Mean Square (LMS) Rule)
The delta learning rule is also referred to as Widrow-Hoff rule, named due to the originators (Widrow
and Hoff, 1960). The delta learning rule is valid only for continuous activation functions and in theaa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.48 Introduction to Neural Networks
the dot product or Euclidean norm, Euclidean norm is most widely used because dot product may re~
quire normalization.
3.3.5 Out Star Learning Rule
Out star leaming rule can be well explained when the neurons are arranged in a layer. This rule is
designed to produce the desired response t from the layer of n neurons. This type of learning is also
called as Grossberg learning.
Out star learning occurs for all units in a particular layer and no competition among these units are
assumed. However the forms of weight updates for Kohonen learning and Grossberg learning areclosely
related.
In the case of out star learning
aw,
. fen —W,) if neuron j wins the competition
=
0 if neuron j losses the competition
The rule is used to provide leaming of repetitive and characteristic properties of input-output rela-
tionships. Though it is concemed with supervised learning, it allows the network to extract statistical
Properties of the input and output signals. It ensures that the output pattern becomes similar to the
undistorted desired output after repetitively applying on distorted output versions. The weight change
here will be a times the error calculated.
3.3.6 Boltzmann Learning
‘The learning is a stochastic learning. A neural net designed based on this leaming is called Boltzmann
earning. In this learning, the nourons constitute a recurrent structure and they work in binary form. This
learning is characterized by an energy function, E, the value of which is determined by the particular
states occupied by the individual neurons of the machine, given by,
= Lhwaan ii
where x; is the state of neuron i and wyis the weight from neuron i to neuron j. The value i#/ means that
none of the neurons in the machine has self feedback. The operation of machine is performed by choos-
ing a neuron at random.
The neurons of this learning process are divided into two groups; visible and hidden. In visible
neurons there is an interface between the network and the environment in which it operates but in
hidden neurons, they operates independent of the environment. The visible neurons might be clamped
‘onto specific states determined by the environment, called as clamped condition. On the other hand,
there is free-running condition, in which all the neurons are allowed to operate freely.
3.3.7 Memory Based Learning
In memory based learning, all the previous experiences are stored in a large memory of correctly classi-
fied input-output examples: (x,44,){4, where 4; is the input vector and 4 is the desired response. The
desired response is a scalar,aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.52 Introduction to Neural Networks
For the 3rd and 4th epoch the separating line remains the same, hence this line separates the boundary
regions as shown in Fig. 3.9.
Xe
\
(IRGIR] Hote Net tor AND Function
‘The same procedure can be repeated for generating the logic function OR, NOT, AND NOT ete.
Example 3.10 Apply the Hebb netto the training patterns that define XOR function with bipolar input and
targets.
Soluation
Input Target
8 b y
1 1 1-1
1-1 1 1
-1 1 1 1
-1 -1 1 -1
By Hebb training algorithm, assigning initial values of the weights w,, & w, to be zero and bias to be zero.
wy = 0 =0 and b= 0
Input Target ‘Weight Changes Weights
& x by yaw AW, Ab wow
o 0 9
1 1 1 -1 -1 -1 -Loo-1 0 =b oo =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 0 o 0
The weight changes are called using,
Aw, =x, yand Ab=yaa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.56 Introduction to Neural Networks
Solution The ‘** symbol indicates that there exist a “+ I’ and ‘.’ Symbol indicates that there exist a ‘- 1".
The inputis givenby, E=[11111-1-1-111111-1-1-11111)
Fs(l1ii1-1-1-111111-1-1-11-1-1-1};
‘The MATLAB program is given as follows
Program
Hebb Net to classify two dimensional input patterns
clear;
cic:
‘Input Patterns
G-[hibit-L-l -11
Fe[l1111-1-1-11
x(1,1:20)=E:
(2,1:20)=F
w(1:20)=0;
tefl -1];
be0;
for in1:2
wewex (4 .1:20)*tC):
bebet(i):
end
disp( ‘Weight matrix’):
displw):
disp( Bias’);
disp(b):
Summary
‘The fundamental models of the artificial neural network was discussed in this chapter. The models were
used to generate the logic functions like AND, OR, XOR etc. The linear seperability concept to obtain
the decision boundary of the regions and the Hebb rule for the pattern classification problem was illus-
trated. The learning rules used in various networks for weight updation process were also derived in this
chapter.
ments sous draa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.How the perceptron learning rule is
better than the Hebb rule.
Layer structure in the original
perceptrons.
Learning and training algorithms in
the perceptron network .
Architecture, algorithm and the
application procedure of the
perceptron net.
Derivation of perceptron algorithm
for several output classes .
Applications of multilayer
Perceptron peepee
Networks
Amy wv>Tto
=
Frank Rosenblatt [1962], and Minsky and Papert [1988], developed large class of artificial neural
networks called Perceptrons. The perceptron learning rule uses an iterative weight adjustment that is
more powerful than the Hebb rule. The perceptrons use threshold output function and the McCulloch-
Pitts model of a neuron. Their iterative learning converges to correct weights, i.e. the weights that
produce the exact output value for the training input pattem. The original perceptron is found to have
three layers, sensory, associator and response units as shown in Fig. 4.1.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.64 Introduction to Neural Networks
Step 5: Compute the activation output of each output unit y_ jy =
1, if Vig > O
if -O 00020
1roaii2 4 1 o 0 0 0 0 00020
aod od-t 2-2-1 =I ° 0 0 0 000020
Initial > -1 1-1-11
-1 1-1-1 1 5 1 1 0 0 0 @ O-1 1-1-1 1
P-lb=1 1 1-1 <1 -1 0 0 0 0 O-1 1-1-1 1
‘The final weights from Epoch | are used as the initial weights for Epoch 2. Thus the output is equal to target
by training for suitable weights.
‘Testing the response of the net
‘The final weights are,
For the Ist set of input, w, =0, w, =0, w3 =0,w,=2,b=0, and
For the 2nd set of input, w, =— 1, w)= 1 w;=-1,w,=-1,b=1
‘The net input is, ¥jq=b + 50x, w,
For the Ist set of inputs,
@ (111)
Yin =0+0X140X140%142x1=2>0
Applying activation, Y= AY) = 1
@ aii-1n
Yoit =OF0X140X140x142% 2<0
Applying activation, y= fly.) =— 1
For 2nd set of inputs,
@ Cli-1-11)
Vim = 14-1X—141x14-1x-14-1x-141x1=5>0
Applying activation, ——_y, = fi
di) (-1-111)
Yoing = 14-1141 x-14-1K-14+-1x14-1x15-1<0
Applying activations, y= fly_iqa) =aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.n Introduction to Neural Networks
01001;
1d;
10111;
O1111;
10111;
11100;
01010;
10011;
111k
11110;
11tda)
Program
clear:
cle;
cdeopen( ‘reg.mat)
‘input=[cd.A":cd.B" :cd.C' :ed.0" sed. E' :e¢.F':0d.G' scd.H' sed.1°:ed.J']";
10
J
output (+. j)=1
else
output(i.j)=0
end
end
end
for t#1:15
test=[cd.k" :cd.L" zed." :¢d.N*:cd.0°)":
net=newp(aw. 10, ‘hard] in’)
net .trainparam. epochs=1000;
net .trainparam.goal=0;
net=train(net.. input output) ;
yesim(net, test)
aysaa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.Example 4.8 With a suitable example simulate the perceptron learning network and separate the bound-
aries. Plot the points assumed in the respective quadrants using different symbols for identification.
Solution Plot the elements as square in the first quadrant, as star in the second quadrant, as diamond in the
third quadrant, as circle in the fourth quadrant. Based on the learning rule draw the decision boundaries.
Progran
Clear;
pl=(1 1]': p2=(12]': %- class 1, first quadrant when we plot the elements. square
p3"[2 -1]': p4=[2 -2]'; %- class 2, 4th quadrant when we plot the elements, circle
p5=[-12]': p6=[-2 1]'; %- class 3, 2nd quadrant when we plot the elements.star
p7*[-1 -1]'; p8=[-2 -2]':% - class 4, 3rd quadrant when we plot the elements diamond
Now, lets plot the vectors
hold on
plot(pi(1).p1(2), 'ks" .p2(1).p2(2). "ks" .p3(1) .p3(2). "ko" .p4(1).p4(2). "ko" )
plot(p5(1).p5(2), 'k*" .p6(1) .p6(2), *k*" .p7(1).p7(2), "kd" .p8(1).p8(2). "kd" )
grid
hold
axis([-3 3 -3.3])&set nice axis on the figure
t1*[0 0]': t2[0 0]': %- class 1. first quadrant when we plot the elements. square
t3-[0 1]': t4=[0 1]"; %- class 2. 4th quadrant when we plot the elements. circle
t5=[1 0]'; t6=[10]': %- class 3, 2nd quadrant when we plot the elements. star
t7#[1 1]'; t8=[11]':% - class 4, 3rd quadrant when we plot the elements, diamond
‘lets simulate perceptron learning
Elaments sous droits d'auteuraa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.80 Introduction to Neural Networks
Example 4.9 Write a MATLAB program for pattern classification using perceptron network. Test train
the net with a noisy pattem. Form the input vectors and noisy vectors from patterns as shown below and store
it in a* mat file,
a + *
++ * 7
* * +
ae * +e
* He aa
<1-4t 0 -4te -111
ae + +e
* * +
” ee ate
* oe ee
* +
1-14 41-1 114
Input vectors
Noisy vectors.
Solution ‘The input vectors and the noisy vectors are stored ina mat file, say class.mal, and the required data
is taken from the file. Here a subfunction called charplot.m is used. The MATLAB program for this is given
below.
Program
Perceptron for pattern classification
clear:
cle
Get the data from file
data=open( ‘class mat")
Sinput pattern
Blarget
tsedata.ts; Testing pattern
nels;
BInitialize the Weight matrix
wezeros(n.m)
bezeros(a. 1.
EIntitalize
alphae1
earning rate and threshold valueaa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.|
84 | Introduction to Neural Neworks
Noisy Input Pattern used for Training
mies me Pr
ae
Classified Output Pattern
4.3. Brief Introduction to |Networks
Multilayer perceptron networks is an important class of neural networks. The network consists of a set
of sensory units that constitute the input layer and one or more hidden layer of computation modes. The
input signal passes through the network in the forward direction. The network of this type is called
multilayer perceptron (MLP).
‘The multilayer perceptrons are used with supervised leaming and have led to the successful back-
propagation algorithm, The disadvantage of the single layer perceptron is that it cannot be extended to
multi-layered version. In MLP networks there exists a non-linear activation function. The widely used
non-linear activstion function is logistic sigmoid function. The MLP network also has various layers of
hidden neurons. The hidden neurons make the MLP network active for highly complex tasks. The layers
of the network are connecied by synaptic weights, The MLP thus has a high computational efficiency.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.aa
You have either reached a page that is unavailable for viewing or reached your viewing limit for this
book.88 Introduction to Neural Neiworks
rule and are applied to various neural network applications. The weights on the interconnections between
the adaline and madaline networks are adjustable, The adaline and madaline networks are discussed in
detail in this chapter
Adaline, developed by Widrow and Hoff [1960], is found to use bipolar activations for its input signals
and target output. The weights and the bias of the adaline are adjustable. The learning rule used canbe
called as Delta rule, Least Mean Square rule or Widrow-Hoffrule. The derivation of this rule with single
output unit, Several output units and its extension has been dealt already in Section 3.3.3. Since the
activation function is an identity function, the activation of the unit is its net input.
‘When adaline is to be used for pattern classification, then, after training, a threshold function is
applied to the net input to obtain the activation
The activation is,
y= @ @e@
The adaline unit can solve the problem with linear separability if it occurs.
5.2.1 Architecture §
‘The architecture of an adaline is shown in Fig. 5.1.
th 7
‘The adaline has only one output unit. This output unit
receives input from several units and also from bias: whose (y,) wy,
activation is always +1. The adaline also resembles asingle —\. aa a
We
layer network as discussed in Section 2.7. It receives input
from several neurons. It should be noted that it also receives
input from the unit which is always ‘+1’, called as bias. The @)—
bias weights are also trained in the same manner as the other jor
weights, In Fig. 5.1, an input layer with xy..-xj--.x,and bias,
aan output layer with only one output neuron is present. The
link between the input and output neurons possess weighted Cy
interconnections. These weights get changed as the trai
progresses.
y
Fig 6:4] Architecture of an Adaline
5.2.2 Algorithm
Basically, the initial weights of adaline network have to be set to small random values and not to zero as
discussed in Hebb or perceptron networks, because this may influence the error factor to be considered.
After the initial weights are assumed, the activations for the input unit are set. The net input is calculated
based on the training input patterns and the weights. By applying delta leaming rule discussed in 3.3.3,
the weight updation is being carried out. The training process is continued until the error, which is the
difference between the target and the net input becomes minimum. The step based training algorithm for
an adaline is as follows:
(Addison-Wesley Data & Analytics Series) Laura Graesser - Wah Loon Keng - Foundations of Deep Reinforcement Learning - Theory and Practice in Python-Addison-Wesley Professional (2019) PDF
(Addison-Wesley Data & Analytics Series) Laura Graesser - Wah Loon Keng - Foundations of Deep Reinforcement Learning - Theory and Practice in Python-Addison-Wesley Professional (2019) PDF