Filter löschen
Filter löschen

NARNET, why i do not get bias=0 and weight -0.9?

1 Ansicht (letzte 30 Tage)
Jorge Rodriguez
Jorge Rodriguez am 7 Apr. 2020
I am trying to understand RNNs properly. I am creating one with narnet. I train it with a sigmoid function with some noise. My purpose is to create one rnn with one neuron in the hidden layer whose activation fuction is the sigmoid, and lineas activation function in the output layer, with a single neuron too. I train the rnn with data generated as y(t) = 1 / ( 1 + exp (-0.9 * y( t - 1 )), so bias should be zero and the weight should be -0.9, but it doesn't work properly.
I give you my code, and I hope you could help my.
Thank you.
clear all;
T = simplenar_dataset
%net = narnet(1:2,10);
net = narnet(1:1,10);
[Xs,Xi,Ai,Ts] = preparets(net,{},{},T);
net = train(net,Xs,Ts,Xi,Ai);
view(net)
%Iw = cell2net(net.IW)
b1 = cell2mat(net.b(1))
Lw = cell2mat(net.Lw)
b2 = cell2mat(net.b(2))
clear all;
nmues=1000;
%y=cell(1,nmues);
y(1)=1/(1+exp(-0.9));
for i=2:nmues;
y(i)=(1/(1+exp(-0.9*y(i-1))))+normrnd(0,.1);
end;
%T2={1;y1nolin};
C={};
C{[1]}=y(1);
for i=1:100;
C{(i)}=y(i);
end;
%plot(1:nmues,y1nolin)
net = narnet(1,1);
net.layers{1}.TransferFcn='logsig';
net.layers{2}.TransferFcn='purelin';
%[inputs,inputStates,layerStates,targets] = preparets(net,{},{},y1nolin);
%[net,tr] = train(net,inputs,targets,inputStates,layerStates);
[Xs,Xi,Ai,Ts] = preparets(net,{},{},C);
net = train(net,Xs,Ts,Xi,Ai);
view(net)
net.IW
net.b(1)
net.Lw
net.b(2)

Antworten (0)

Kategorien

Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by