Beruflich Dokumente
Kultur Dokumente
ACTIVITY1:Design a neural network for approximation of xor problem in matlab and compare the
end
for j=1:h
for i=1:n
delv(i,j)=alpha*delj(j,1)*x(i,I)+mf*(v
(i,j)-v1(i,j));
end
end
delb1=alpha*delj;
w1=w;
v1=v;
w=w+delw;
b2=b2+delb2;
v=v+delv;
b1=b1+delb1';
e=e+(t(I)-y(I))^2;
end
rmse=(sqrt(e))/N;
epoch=epoch+1;
x11(epoch)=epoch;
if epoch==5000
con=0;
end
if(epoch<60000)
y11(epoch)=rmse;
end
end
disp('rmse')
disp(rmse)
plot(alpha,rmse,'p')
disp('c');
disp(c);
c=c+1;
hold on;
end
-3
x 10
Bipsig:
function y=bipsig(x)
y=(1-exp(-x))/(1+exp(-x));
bipsig1:
function y= bipsig1(x)
y=0.5*(1+bipsig(x))*(1-bipsig(x));
2
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
2]Momentum
delb1=alpha*delj;
w1=w;
v1=v;
w=w+delw;
b2=b2+delb2;
v=v+delv;
b1=b1+delb1';
e=e+(t(I)-y(I))^2;
end
rmse=(sqrt(e))/N;
epoch=epoch+1;
x11(epoch)=epoch;
if epoch==5000
con=0;
end
if(epoch<60000)
y11(epoch)=rmse;
end
end
disp('rmse')
disp(rmse)
plot(mf,rmse,'p')
zin(j)=b1(j);
for i=1:n
zin(j)=zin(j)+x(i,I)*v(i,j);
end
z(j)=bipsig(zin(j));
end
yin= b2+ z*w;
y(I)=bipsig(yin);
delK=(t(I)-y(I))*bipsig1(yin);
delw=alpha*delK*z'+mf*(w-w1);
delb2=alpha*delK;
delinj=delK*w;
for j=1:h
delj(j,1)=delinj(j,1)*bipsig1(zin(j));
end
for j=1:h
for i=1:n
delv(i,j)=alpha*delj(j,1)*x(i,I)+mf*(v(i,
j)-v1(i,j));
end
end
disp('c');
disp(c);
c=c+1;
hold on;
end
-3
x 10
8
7
6
5
4
3
2
1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
EXPERIMENT NO:3
ACTIVITY1: Design a neural network for approximation of F(X,Y)=sin(x)*cos(y) problem using back
propagation algorithm.
SOFTWARE TOOLS USED: MATLAB 7
CODING:
for j=1:h
for i=1:n
delv(i,j)=alpha*delj(j,1)*x(i,I)+mf*(v(i,j)-v1(i,j));
end
end
delb1=alpha*delj;
w1=w;
v1=v;
w=w+delw;
b2=b2+delb2;
v=v+delv;
b1=b1+delb1';
e=e+(t(I)-y(I))^2;
end
SSE=e;
rmse=(sqrt(e))/N;
epoch=epoch+1;
x11(epoch)=epoch;
if epoch==250
con=0;
end
if(epoch<60000)
y11(epoch)=SSE;
end
end
disp('rmse')
disp(rmse)
figure()
plot(x11,y11,'-+b')
for I=1:N
for j=1:h
zin(j)=b1(j);
for i=1:n
zin(j)=zin(j)+x(i,I)*v(i,j);
end
z(j)=bipsig(zin(j));
end
yin=b2+z*w;
y(I)=bipsig(yin);
MEGHA CHITRANSHI 112006
mf=0.7;
e1=0;
con=1;
epoch=0;
while con
e=0;
EE=0;
for I=1:N
for j=1:h
zin(j)=b1(j);
for i=1:n
zin(j)=zin(j)+x(i,I)*v(i,j);
end
z(j)=bipsig(zin(j));
end
yin=b2+z*w;
y(I)=bipsig(yin);
delK=(t(I)-y(I))*bipsig1(yin);
delw=alpha*delK*z'+mf*(w-w1);
delb2=alpha*delK;
delinj=delK*w;
for j=1:h
delj(j,1)=delinj(j,1)*bipsig1(zin(j));
end
end
z=reshape(y,sqrt(N),sqrt(N));
figure()
surfc(a,b,z);
title('plot of function f(x,y)');
xlabel('x axis');
ylabel('y axis');
zlabel('z axis');
z axis
0.5
-0.5
-1
8
6
8
6
2
0
y axis
x axis
90
80
0.5
z axis
70
0
60
-0.5
50
-1
8
40
8
4
2
y axis
30
4
2
0 0
20
x axis
50
100
150
200
250