Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
The corrections to w1 and w2 is obtained approx as below, which can be improved with
accelerating factor say alp and f(x)*(1-f(x).
1.
1.
1.
w1 =
0.2113249 0.0002211 0.6653811
0.7560439 0.3303271 0.62839
w2
0.8497452 0.0683740
0.6857310 0.5608486
0.8782165 0.6623569
we get
aout =
0.6966785
0.7611054
0.8069129
and error
err =
0.3033215
0.2388946
0.1930871
0.0515322
0.0998183
0.1276000
As already mentioned the speed etc can be improved .
ni =3 // input nodes
nh =2 // hidden nodes
no =3 // output nodes
c= 1 // sigmoid constant
niter=5
function [sg ]= sig( c, x)
nx= length(x) ;
on=ones(1,nx) ;
sg= (on' + exp(-c*x) ) ;
sg=on'. /sg;
endfunction
function [dw] =dw2(err,w2)
terr=[] ;// build total error matrix
sz=size(w2) ;
nh=sz(1,2) ;
for i =1:nh
terr =[terr , err] ;
end
dw = w2.*terr ;// correction matrix
endfunction
eint=[] ;
for i=1:nh
eint =[ eint ;ein'] ;
end
dw1 = eint.*ts ;