[nmse v mse] = ccl_error_nmse(Y,Yp) Calculate normalised mean square error Input: Y Target data points Yp Predictions Output: nmse Normalised mean square error v Variance in the observations mse Mean square error
0001 function [nmse v mse] = ccl_error_nmse(Y,Yp) 0002 % [nmse v mse] = ccl_error_nmse(Y,Yp) 0003 % 0004 % Calculate normalised mean square error 0005 % 0006 % Input: 0007 % 0008 % Y Target data points 0009 % Yp Predictions 0010 % 0011 % Output: 0012 % 0013 % nmse Normalised mean square error 0014 % v Variance in the observations 0015 % mse Mean square error 0016 0017 % CCL: A MATLAB library for Constraint Consistent Learning 0018 % Copyright (C) 2007 Matthew Howard 0019 % Contact: matthew.j.howard@kcl.ac.uk 0020 % 0021 % This library is free software; you can redistribute it and/or 0022 % modify it under the terms of the GNU Lesser General Public 0023 % License as published by the Free Software Foundation; either 0024 % version 2.1 of the License, or (at your option) any later version. 0025 % 0026 % This library is distributed in the hope that it will be useful, 0027 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0028 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0029 % Lesser General Public License for more details. 0030 % 0031 % You should have received a copy of the GNU Library General Public 0032 % License along with this library; if not, write to the Free 0033 % Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 0034 0035 N = size(Y,2); % get no. data points 0036 mse = sum((Y-Yp).^2,2)/N; % get mean squared error 0037 v = var(Y,0,2); % get variance 0038 nmse = mse/v; % compute nmse 0039