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

 채택된 답변

per isakson
per isakson 2016년 7월 7일
편집: per isakson 2016년 7월 7일
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

per isakson
per isakson 2016년 7월 7일
편집: per isakson 2016년 7월 7일
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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

질문:

2016년 7월 7일

편집:

2016년 7월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by