Usage problem of saved neural network

I have used nnstart to predict future values of my time-series data, what is succeded, and I saved the network to .m file, what I can't use for further use for similar data. The automatically generated script works if the final line is outputs = train(net,inputs,targets,inputStates,layerStates); but is not working with the saved net instead of train, even not with the data the saved network trained with. So I tried just simply to replace the
outputs = train(net,inputs,targets,inputStates,layerStates);
to
load('mynet', 'net');
outputs = net(inputs,inputStates,layerStates);
or even
outputs = net(inputs,inputStates,layerStates,targets);
but not works, even not for the same sample data that it used for the train. The code was:
inputSeries = pollutionInputs;
targetSeries = pollutionTargets;
inputDelays = 1:2;
feedbackDelays = 1:2;
hiddenLayerSize = 10;
load('mynet', 'net')
[inputs,inputStates,layerStates,targets] = preparets(net,inputSeries,{},targetSeries);
outputs = net(inputs,inputStates,layerStates);
Where the final line produces the error:
Output argument "data" (and maybe others) not assigned during call to "C:\Program
Files\MATLAB\R2012b\toolbox\nnet\nnet\@network\sim.m>simData".
Error in network/sim (line 291)
[data,err] = simData(net,X,Xi,Ai,T,EW);
Error in network/subsref (line 17)
otherwise, v = sim(vin,subs{:});
Error in narx2 (line 71)
outputs = net(inputs,inputStates,layerStates);
What could cause the problem, and how I could use the saved and loaded network for new datas?
Thank you in advance!

 Respuesta aceptada

Greg Heath
Greg Heath el 7 de Oct. de 2014
1. Check the loaded net to make sure it has all the correct properties
net = net % NO SEMICOLON!
2. Sequentially remove ending semicolons to make sure the command line outputs at each stage makes sense.
Hope this helps.
Thank you for formally accepting my answer
Greg

1 comentario

Roland Kilik
Roland Kilik el 7 de Oct. de 2014
Starting from your advice (however I already examined the command line output of net before) it seems to work. At least, net = net produced only "[1x1 network]", but net=load('mynet', '-mat') netin=net.mynet seems to work, as it displays all the struct of the newrok
Thank you!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Deep Learning Toolbox en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 6 de Oct. de 2014

Comentada:

el 7 de Oct. de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by