how to update weigth in Rprop?

1 view (last 30 days)
Robin
Robin on 16 Jul 2013
hello i want to make a NN with rprop for my final task but my program take to much looping and not find the final weight help my to solve my problem
below i will put my simple program, please help
x=[1 3 5 7 9]';
t=[1;0];
a=-1;
b=1;
w=a + (b-a).*rand(2,5);
nett=w*x;
y=1./(1+exp(-nett));
jlhout=2;
jlhin=5;
delta=ones(jlhout,jlhin)*0.1;
dE=ones(jlhout,jlhin);
cost = 0.5 * sum((t-y).^2);
epoch=0;
while cost > 0.1
np=1.2;
nm=0.5;
dmax=1;
dmin=exp(-6);
de=(t-y).*y.*(1-y)*x';
for k =1 : jlhout
for j=1 : jlhin
if (dE(k,j)*de(k,j)>0)
d(k,j)=min(np*delta(k,j),dmax);
else if (dE(k,j)*de(k,j)<0)
d(k,j)=max(nm*delta(k,j),dmin);
else
d(k,j)=delta(k,j);
end
end
end
end
for k =1 : jlhout
for j=1 : jlhin
if (de(k,j)>0)
dw(k,j)=-1*(d(k,j));
else if (de(k,j)<0)
dw(k,j)=d(k,j);
else
dw(k,j)=0;
end
end
end
end
w=w+dw;
nett=w*x;
y=1./(1+exp(-nett));
cost = 0.5 * sum((t-y).^2);
dE=de;
delta=d;
epoch=epoch+1;
end
thank you for you attention and thank you for your help God bless

Answers (0)

Categories

Find more on Modeling in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!