How do I get the mse after trainin a NN?
1 view (last 30 days)
Show older comments
Hi everyone,
I want to receive the mse from the trained neural network. To make it simple i form a 3 loops, where the out-of-sample time period is t=12, j=2 is the number of predictor and i=2 are the hidden units. Hence, at the end I should receive 2 mse, one for each predictor. I run the following code but the result doesn't look right. Any help please?
>> net = fitnet(hiddenLayerSize);
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 30/100;
net.divideParam.testRatio = 0/100;
net.trainParam.showWindow=false;
% net.trainFcn = 'trainbr';
% net.trainFcn = 'trainscg';
for t=1:12;
for j=1:2;
for i=1:2
[net,tr] = train(net,inputs(j,1:60+t-1),targets(:,2:60+t));
outputs = net(inputs(j,60+t));
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs);
MSEtrn(j) = tr.perf(end)
MSEval = tr.vperf(end)
MSEtst = tr.tperf(end)
end;
end
end
Thanks in advance!
0 Comments
Answers (1)
Greg Heath
on 13 Dec 2016
There is no reason to consider individual vector components.
Rewrite your code in vector form like most of the code that is posted in both NEWSGROUP and ANSWERS. For example, search on
greg fitnet train
Hope this helps.
Greg
0 Comments
See Also
Categories
Find more on Define Shallow Neural Network Architectures in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!