function [logmax,dL]=nolin1d_grad_optag_durlev(x,M,y) % NOLIN1D_GRAD_OPTAG_DURLEV is an optimisation script for the training % of Gaussian process prior models, in cases where covariance matrices are % Toeplitz. % % [LOGMAX,DL] = NOLIN1D_GRAD_OPTAG_DURLEV(x,M,y) % % This optimisation script uses only Gradient information to perform % optimisation for Gaussian process prior models, by adapting % hyperparameters to minimise negative the log-likelihood function, % % logmax = log(det(Q)) + N0*log(y'*inv(Q)*y) % % The prior covariance function used is of the form, % % C(zi,zj) = exp([zi-zj]'*g*[zi-zj]) + v % % Inputs: % x = Hyperparameters, [g v] % M = Input explanatory variable, of dimension {N0 x 1} % y = Outcome (vector) from every input of the explantory variable % % Outputs: % LOGMAX = Negative log-likelihood function value % DL = Gradient vector values % % Note that, this GP optimisation script is meant for strictly % one-dimensional time-series input explanatory variable only. This script % does not utilise user-supplied Hessian information. % % This function script utilises modified Durbin-Levinson's algorithm to % construct fast algorithm for computation of task impossible by standard % MATLAB command. % % % (C) Gaussian Process Toeplitz Toolbox 1.0 % (C) Copyright 2005-2007, Keith Neo % http://www.hamilton.ie g=exp(x(1)); V=exp(x(2)); N0=size(M,1); p=[1 g V]; ct=toep2_genct(M,p); invb=toep2_invcy(ct,y); yQy=y'*invb; [logdet,ds,vn1]=toep2_logdet(ct); logmax=logdet+N0*log(yQy); tmp=-0.5*g*(M'-M(1,1)).^2; dt=tmp.*exp(tmp); tmp=toe_times_y(dt,invb); bdQb=invb'*tmp; trdQ=toep2_trace(ds,vn1,dt); dt=[1 zeros(1,N0-1)]; trQ=toep2_trace(ds,vn1,dt); Ny=N0/yQy; yQQy=invb'*invb; dL=zeros(2,1); dL(1,1)=trdQ-Ny*bdQb; dL(2,1)=V*(trQ-Ny*yQQy);