Home > subfunctions > ccl_obj_ncl.m

ccl_obj_ncl

PURPOSE ^

[fun J] = ccl_obj_ncl (model, W, BX, U)

SYNOPSIS ^

function [fun J] = ccl_obj_ncl (model, W, BX, U)

DESCRIPTION ^

 [fun J] = ccl_obj_ncl (model, W, BX, U)

 Learning objective function for learning nullspace component. The goal is
 to model the nullspace component Uns such that the difference between P*U
 and the learnt Uns is minimised. P is a projection matrix that projects U
 onto the image space of Uns.

 Input:

    model                              Current model
    W                                  Weights
    BX                                 B(X)
    U                                  Observed actions

 Output:

    fun                                Error function of weight W
    J                                  Jacobian

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [fun J] = ccl_obj_ncl (model, W, BX, U)
0002 % [fun J] = ccl_obj_ncl (model, W, BX, U)
0003 %
0004 % Learning objective function for learning nullspace component. The goal is
0005 % to model the nullspace component Uns such that the difference between P*U
0006 % and the learnt Uns is minimised. P is a projection matrix that projects U
0007 % onto the image space of Uns.
0008 %
0009 % Input:
0010 %
0011 %    model                              Current model
0012 %    W                                  Weights
0013 %    BX                                 B(X)
0014 %    U                                  Observed actions
0015 %
0016 % Output:
0017 %
0018 %    fun                                Error function of weight W
0019 %    J                                  Jacobian
0020 
0021 
0022 
0023 
0024 % CCL: A MATLAB library for Constraint Consistent Learning
0025 % Copyright (C) 2007  Matthew Howard
0026 % Contact: matthew.j.howard@kcl.ac.uk
0027 %
0028 % This library is free software; you can redistribute it and/or
0029 % modify it under the terms of the GNU Lesser General Public
0030 % License as published by the Free Software Foundation; either
0031 % version 2.1 of the License, or (at your option) any later version.
0032 %
0033 % This library is distributed in the hope that it will be useful,
0034 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0035 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0036 % Lesser General Public License for more details.
0037 %
0038 % You should have received a copy of the GNU Library General Public
0039 % License along with this library; if not, write to the Free
0040 % Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
0041 
0042 [dim_U, dim_N ] = size(U) ;
0043 lambda  = 1e-8;
0044 W       = reshape(W, dim_U, model.num_basis );
0045 J       = zeros( dim_N, model.num_basis * dim_U);
0046 fun     = zeros( dim_N, 1 );
0047 
0048 for n = 1 : dim_N
0049     b_n     = BX(:,n);
0050     u_n     = U (:,n);
0051     Wb      = W    * b_n;
0052     c       = Wb'  * Wb;
0053     a       = u_n' * Wb;
0054     j_n     = ( u_n*b_n'*c - Wb*b_n'*(c+a - 2*lambda) ) / (sqrt(c)*c);
0055     J(n,:)  = j_n(:);
0056     fun(n)  = (a-c + lambda)/sqrt(c);
0057 end
0058 end

Generated on Mon 01-Jan-2018 15:49:39 by m2html © 2005