model = ccl_learna_sa (BX, RnUn, model) Learning the constraint vector Input: BX Higher dimensional representation of X using gaussian kernel RnUn RnUn=Rn*Un model Model learnt from the last iteration Output model Updated model with the k^th constraint
0001 function model = ccl_learna_sa (BX, RnUn, model) 0002 % model = ccl_learna_sa (BX, RnUn, model) 0003 % 0004 % Learning the constraint vector 0005 % Input: 0006 % BX Higher dimensional representation of X using gaussian kernel 0007 % RnUn RnUn=Rn*Un 0008 % model Model learnt from the last iteration 0009 % Output 0010 % model Updated model with the k^th constraint 0011 0012 %options.MaxFunEvals = 1e6 ; 0013 options.MaxIter = 1000 ; 0014 options.TolFun = 1e-6 ; 0015 options.TolX = 1e-6 ; 0016 options.Jacobian = 0 ; 0017 0018 obj = @(W) ccl_obj_AUn (model, W, BX, RnUn) ; % setup the learning objective function 0019 model.nmse = 10000000 ; 0020 for i = 1:1 % normally, the 1 attempt is enough to find the solution. Repeat the process if the process tends to find local minimum (i.e., for i = 1:5) 0021 W = rand(1, (model.dim_u-model.dim_k)* model.dim_b) ; % make a random guess for initial value 0022 W = ccl_math_solve_lm (obj, W, options ); % use a non-linear optimiser to solve obj 0023 nmse = mean(obj(W).^2) / model.var ; 0024 fprintf('\t K=%d, iteration=%d, residual error=%4.2e\n', model.dim_k, i, nmse) ; 0025 if model.nmse > nmse 0026 model.w{model.dim_k}= reshape(W, model.dim_u-model.dim_k, model.dim_b) ; 0027 model.nmse = nmse ; 0028 end 0029 if model.nmse < 1e-5 % restart a random initial weight if residual error is higher than 10^-5 0030 break 0031 end 0032 end 0033 end