[ncpe, v, mse] = ccl_error_ncpe(F, Fp, P) Calculate the normalised constrained policy error (nCPE). This quantity is used to evaluate the quality of the leart policy under the same constrains Input: F True Null space policy control commands Fp Learnt Null space policy control commands P Null space projection Output: ncpe Normalised constrained policy error v Variance in the true policy commands mse Mean square error of the learnt policy
0001 function [ncpe, v, mse] = ccl_error_ncpe(F, Fp, P) 0002 % [ncpe, v, mse] = ccl_error_ncpe(F, Fp, P) 0003 % 0004 % Calculate the normalised constrained policy error (nCPE). This quantity 0005 % is used to evaluate the quality of the leart policy under the same 0006 % constrains 0007 % 0008 % Input: 0009 % 0010 % F True Null space policy control commands 0011 % Fp Learnt Null space policy control commands 0012 % P Null space projection 0013 % 0014 % Output: 0015 % ncpe Normalised constrained policy error 0016 % v Variance in the true policy commands 0017 % mse Mean square error of the learnt policy 0018 0019 0020 0021 0022 % CCL: A MATLAB library for Constraint Consistent Learning 0023 % Copyright (C) 2007 Matthew Howard 0024 % Contact: matthew.j.howard@kcl.ac.uk 0025 % 0026 % This library is free software; you can redistribute it and/or 0027 % modify it under the terms of the GNU Lesser General Public 0028 % License as published by the Free Software Foundation; either 0029 % version 2.1 of the License, or (at your option) any later version. 0030 % 0031 % This library is distributed in the hope that it will be useful, 0032 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0033 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0034 % Lesser General Public License for more details. 0035 % 0036 % You should have received a copy of the GNU Library General Public 0037 % License along with this library; if not, write to the Free 0038 % Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 0039 0040 for n=1:size(P,3) 0041 Y (:,n) = P(:,:,n)*F (:,n); 0042 Yp(:,n) = P(:,:,n)*Fp(:,n); 0043 end 0044 [d1 d2 mse] = ccl_error_nmse(Y,Yp); 0045 v = var(F,0,2); % get variance 0046 ncpe = sum(mse)/sum(v); 0047