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
Mary Smith
Mary Smith 2016 年 7 月 7 日
Really work, i love you so much !!! thank for all.
XOXO

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDeep 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