It is possible to save the all struct consecutively using Neural Network

Hi guyss!!! please help me with my problem :)
I created a routine to save the output value of a sequence of routines neural networks.
I can save the output values for each routine I do, but i dont know how to save the file tr (file structure) and know the basics and weights of each routine made.
What do I need to add to save all data for each routine made? (tr,weight, etc..)
I need to do 30 routines of neural networks.
for i = 1:30
% Create a Fitting Network
hiddenLayerSize = 8;
net = fitnet(hiddenLayerSize);
% Set up Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
[pn,ps] = mapminmax(p);
[tn,ts] = mapminmax(t);
[net,tr] = train(net,pn,tn);
an = sim(net,pn);
a = mapminmax('reverse',an,ts);
Output(:,i)=a;
end

 Réponse acceptée

per isakson
per isakson le 7 Juil 2016
Modifié(e) : per isakson le 7 Juil 2016
There are many ways to achieve "... save all data for each routine made? (tr,weight, etc..)", one of which store the result and supplementary data in a structure array. (I guess, "each routine" means each iteration of the loop.) Try
>> out = cssm( p, t )
out =
1x30 struct array with fields:
Output
ps
tr
weight
etc
where
function out = cssm( p, t )
len = 30;
out = struct( 'Output',cell(1,len), 'ps',[], 'tr',[], 'weight',[], 'etc','' );
for jj = 1:len
% Create a Fitting Network
hiddenLayerSize = 8;
net = fitnet( hiddenLayerSize );
% Set up Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
[pn,ps] = mapminmax(p);
[tn,ts] = mapminmax(t);
[net,tr] = train(net,pn,tn);
an = sim(net,pn);
a = mapminmax('reverse',an,ts);
out(jj).Output = a;
out(jj).ps = ps;
out(jj).tr = tr;
out(jj).etc = 'et cetera';
end
end

2 commentaires

per isakson
per isakson le 7 Juil 2016
Modifié(e) : per isakson le 7 Juil 2016
You must store cssm in a separate file, cssm.m, containing no other executable code. See http://uk.mathworks.com/matlabcentral/answers/293720#comment_377711
Really work, i love you so much !!! thank for all.
XOXO

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by