Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Clarity about MSE for Neural Network with Multiple Outputs

587 views
Skip to first unread message

Sampath Kumar Yerra

unread,
Oct 26, 2016, 2:57:09 AM10/26/16
to
For neural networks with multiple outputs, I find that two kinds of normalization are available: 'standard' and 'percent'. If I understand correctly, standard normalization involves the following steps in that order:
- normalize all targets and outputs within [-1,1] using mapminmax
- calculate errors for each target-output pair using gsubtract
- calculate mean of squared errors (mse) for each target-output pair
- finally a single value which is the mean of mse's of all target-output pairs is reported by MATLAB

I calculated mean squared error for a multi-ouput network using the above steps individually and compared with the value computed by MATLAB using mse(net,targets,outputs,'normalization','standard'). I find that both values do not match. Did I miss something?

Also, how 'percent' normalization works? An illustration with an example really helps. Thanks in advance.

Sampath Kumar Yerra

unread,
Oct 27, 2016, 3:33:09 AM10/27/16
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);
0 new messages