Why does my neural network fail to train when I introduce feedback components using Neural Network Toolbox 6.0 (R2008a)?

4 views (last 30 days)
I am creating a custom Elman network as follows and attempting to train it:
clear variables;
p = rand(2,10);
t = rand(2,10);
net=newelm(p,t,[5,4,2],{'tansig','tansig','purelin'},'trainrp');
net.layerConnect(1,1)=0;
net.layerConnect(2,2)=0;
net.layerConnect(1,3)=1;
net=init(net);
[net,tr]=train(net,p,t);
However I get the following error message
??? Error using ==> network.train at 129
Network contains a zero-delay loop.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This error occurs because the following line in the code
net.layerConnect(1,3)=1;
creates a feedback loop with a zero delay connection between the output of the third hidden layer and the input of the first layer, which implies that there is no good starting point for training the network.
In general, all non-feed-forward lines require non-zero delays. To make the above network work, one can modify the delay value as follows
net.layerWeights{1,3}.delays = [1];

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2008a

Community Treasure Hunt

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

Start Hunting!