Sampath Kumar Yerra
unread,Oct 27, 2016, 3:33:09 AM10/27/16You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hi All, I found the solution to my question. Actually, the normalization needs to be done prior to calculation of errors. The following code can be used to check the computation of MSE by different methods in MATLAB for neural network problems.
% msecheck.m: For computation of MSE for multi-output neural network problems
% This code works for any problem having two outputs.
clear; clc;
load('inputs.mat'); % loads inputs into variable 'x'
load('outputs.mat'); % loads outputs into variable 't'
net = feedforwardnet(10);
net = train(net,x,t);
y = net(x);
% Method 1: MSE by Standard Normalization
% This method uses mapminmax function which maps each target and its
% corresponding output within [-1,1] by default
msestdfcn= mse(net,t,y,'normalization','standard');
% Verification of the above function through individual steps
[t1m,PS]= mapminmax(t(1,:));
y1m= mapminmax('apply',y(1,:),PS);
[t2m,PS]= mapminmax(t(2,:));
y2m= mapminmax('apply',y(2,:),PS);
mse1= mse(t1m-y1m);
mse2= mse(t2m-y2m);
msestd= (mse1+mse2)/2;
fprintf('MSE-Standard Funtion: %f\n', msestdfcn);
fprintf('MSE-Standard-Individual Steps: %f\n', msestd);
% Method 2: MSE by Percent Normalization
% This method also uses mapminmax function but maps each target and its
% corresponding output within [-1/n,1/n] by default where n=No. of outputs.
msepctfcn= mse(net,t,y,'normalization','percent');
% Verification of the above function through individual steps
% In this example, as there are two outputs/targets, n=2. Hence, each
% output parameter should me mapped within [-0.5,0.5]
[t1m,PS]= mapminmax(t(1,:),-0.5,0.5);
y1m= mapminmax('apply',y(1,:),PS);
[t2m,PS]= mapminmax(t(2,:),-0.5,0.5);
y2m= mapminmax('apply',y(2,:),PS);
mse3= mse(t1m-y1m);
mse4= mse(t2m-y2m);
msepct= (mse3+mse4)/2;
fprintf('\nMSE-Percent Funtion: %f\n', msepctfcn);
fprintf('MSE-Percent-Individual Steps: %f\n', msepct);