0% found this document useful (0 votes)
18 views3 pages

Ex 10

Lab Practical

Uploaded by

Mukul Bansal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views3 pages

Ex 10

Lab Practical

Uploaded by

Mukul Bansal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Experiment-10

Objective: Write a MATLAB code to store vector in an auto-associative net. Find


weight matrix & test the net with input.
This is a single layer neural network in which the input training vector and the output target vectors
are the same. The weights are determined so that the network stores a set of patterns.
Architecture:
As shown in the following figure, the architecture of Auto Associative memory network
has ‘n’ number of input training vectors and similar ‘n’ number of output target vectors.

Figure-10.1: Architecture of auto-associative net

Training Algorithm
For training, this network is using the Hebb or Delta learning rule.
Step 1 − Initialize all the weights to zero as
wij = 0 i=1ton, j=1ton
Step 2 − Perform steps 3-4 for each input vector.
Step 3 − Activate each input unit as follows −
xi=si (i=1 ton)
Step 4 − Activate each output unit as follows −
yj=sj (j=1 ton)
Step 5 − Adjust the weights as follows −
wij (new)=wij (old) + xiyj

A20405220016 YASH JAIN


Testing Algorithm
Step 1 − Set the weights obtained during training for Hebb’s rule.
Step 2 − Perform steps 3-5 for each input vector.
Step 3 − Set the activation of the input units equal to that of the input vector.
Step 4 − Calculate the net input to each output unit j = 1 to n
𝑦𝑖𝑛𝑗 = ∑𝑛𝑖=1 𝑥𝑖. 𝑤𝑖𝑗
Step 5 − Apply the following activation function to calculate the output
𝑦𝑗 = f (𝑦𝑖𝑛𝑗) = +1 if 𝑦𝑖𝑛𝑗 > 0
−1 if 𝑦𝑖𝑛𝑗 ⩽0
MATLAB Code:
clc;
clear;
x=[-1 -1 -1 -1;-1 -1 1 1]; t=[1 1 1 1];
w=zeros(4,4);
for i=1:2
w=w+x(i,1:4)'*x(i,1:4);
end
yin=t*w;
for i=1:4
if yin(i)>0
y(i)=1;
else
y(i)=-1;
end
end
disp('The calculated Weight Matrix');
disp(w);
if x(1,1:4)==y(1:4)| x(2,1:4)==y(1:4)
disp('The Vector is a Known vector');
else
disp('The Vector is a UnKnown vector');
end

A20405220016 YASH JAIN


Output:
The calculated Weight Matrix
2 2 0 0
2 2 0 0
0 0 2 2
0 0 2 2

A20405220016 YASH JAIN

You might also like