How do I get the mse after trainin a NN?

조회 수: 2 (최근 30일)
gsourop
gsourop 2016년 12월 8일
답변: Greg Heath 2016년 12월 13일
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!

답변 (1개)

Greg Heath
Greg Heath 2016년 12월 13일
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

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by