Recurrent Neural Network output not working on test data (it converges abruptly after a number of steps)

2 次查看(过去 30 天)
I have a dataset of 5 inputs and 2 outputs of 11520 samples and i'm using it to train a recurrent neural network and see how it works on some test data of 2881 samples.
From the learning data, I use my input 5x11520 matrix to generate X_learn (1x11520 cells of 5x1 double) and my output 2x11520 matrix to generate T_learn (1x11520 cells of 2x1 double).
I created and trained the network as shown in the official documentation. My code is the following:
net = layrecnet([1:5],[3]); %a network with one hidden layer of 3 nodes and 5 delay steps
[Xs,Xi,Ai,Ts] = preparets(net,X_learn,T_learn);
net = train(net,Xs,Ts,Xi,Ai);
This is what the network looks like with view(net):
To see how the trained network behaves on both the learning and test data, i do the following.
Fist, to evaluate it on the learning data:
Y_learn=net(X_learn); %feeds the inputs to the network
c_learn=cell2mat(Y_learn); %turns the result into a matrix of 2x11520
And if i plot, let's say the output number 1 (of 2), both from the target and the net's output, here the result:
To test the net on the test data, I used my input 5x2881 matrix of the test samples to generate X_test (1x2881 cells of 5x1 double). Then I feed it to the network:
Y_test=net(X_test); %feeds the test inputs to the network
c_test=cell2mat(Y_test); %turns the result into a matrix of 2x2881
But when i plot both the target and the net's output from the test data, here's the result:
Apparently it works on the first 381 samples (kind of) and then the net's output converges to a specific value. Same happens with the output 2 (only the value it converges to changes).
I'm obviously missing something important, but i can't understand what.
Thank you

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by