How to store R-value and MSE value in workspace while using Neural Network

3 views (last 30 days)
Hi, I'm working on developing a neural network with 2 input variables and 1 output. I'm a beginner in Neural Networks, so I tried to use 'nftool' GUI to setup and train the network. Once I was done with one training session, I generated an 'M-file' and was able to successfully execute the same training. Now, the problem that I face is that, I'm not sure how to save the 'R' Value and the 'MSE' value to the workspace. My Matlab version is 2009b. Please advise.

Accepted Answer

Greg Heath
Greg Heath on 19 Oct 2012
If you use the syntax
[ net tr ] = train(net, x, t);
Most of the important training info is in the structure tr. Type, without the ending smicolon,
tr = tr
Hope this helps.
Thank you for formally accepting my answer.
Greg
  4 Comments
chaudhry
chaudhry on 13 Oct 2013
Hi Greg, thank you very much for the good answer and how to reduce MSE value and kindly explain which is more important MSEtrn or MSEval or MSEtst. which MSE value is acceptable.
Greg Heath
Greg Heath on 13 Oct 2013
Edited: Greg Heath on 13 Oct 2013
Naïve Constant Output Model
y00 = repmat(mean(t,2),1,N);
e00 = t-y00;
MSE00 = mse(e00)
MSE00 = mean(var(t',1)) % Surprised? ... Think about it.
Neural Net Model
[ net tr y e ] = train(net,x,t);
% y = net(x);
% e = t-y;
MEANe = mean(e) % 0
MSE = mse(e)
MSE = mean(var(e',1)) % Surprised? ... Think about it.
NMSE = MSE/MSE00 % Normalized MSE
R2 = 1-NMSE % R^2, coefficient of determination (see Wikipedia)
R = sqrt(R2) % Surprised?
Individual trn/val/tst contributions can be deduced using the indices in tr.
Greg

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!