How to test RNN (layrecnet) ?

5 visualizaciones (últimos 30 días)
Machine Learning Enthusiast
Machine Learning Enthusiast el 30 de Sept. de 2019
Respondida: Jash Kadu el 13 de Jul. de 2022
I have trained my time series data using Recurrent Neural Network (RNN)/ layrecnet function to make predictions.
Now i want to test the trained model with new(test) data.
Can anybody please confirm weather i have implemented the below code correctly?
data=HomeA';
N=50;
XTrain = data(1:end-N);
YTrain = data(1:end-N);
%
XTest=data(end-N+1:end);
YTest = data(end-N+1:end);
X = tonndata(XTrain,true,false);
T = tonndata(YTrain ,true,false);
X2 = tonndata(XTest,true,false);
T2 = tonndata(YTest ,true,false);
%% Build Recurrent neural network
net = layrecnet(1:2,10);
[Xs,Xi,Ai,Ts] = preparets(net,X,T);
net = train(net,Xs,Ts,Xi,Ai);
%view(net)
Y = net(Xs,Xi,Ai);
perf = perform(net,Y,Ts)
%% Test the model on new data
[Xs1,Xio,Aio] = preparets(net,X,T);
[Y1,Xfo,Afo] = net(Xs1,Xio,Aio);
[netc,Xic,Aic] = closeloop(net,Xfo,Afo);
[yPred,Xfc,Afc] = netc(X2,Xic,Aic);
TestPerformance = perform(net,yPred,T2);

Respuestas (1)

Jash Kadu
Jash Kadu el 13 de Jul. de 2022
Hi!
Please check out the documentation for Layer recurant neural network : https://www.mathworks.com/help/deeplearning/ref/layrecnet.html.
You can also run the following command;
openExample('nnet/RefLayRecNetExample') in your MATLAB editor to test it.

Categorías

Más información sobre Deep Learning Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by