function [gdt,vdt,adt,fdt]=nolin_dynls(MT,y,g,v,ord,per) % NOLIN_DYNLS Identifies the hyperparameter values using dynamic % lengthscale algorithm. % % [gdt,vdt,adt,fdt] = NOLIN_DYNLS(MT,y,g,v,ord,per) % % Inputs: % MT = Input time-series explanatory variables % y = Corresponding output vector % g = Starting initial of the lengthscale hyperparameter value % v = Starting initial of the noise hyperparameter value % ord = Order of the reduction in the state-space dataset % per = Percentage value of confidence level % % Outputs: % gdt = List of lengthscale hyperparameter values % vdt = List of noise hyperparameter values % adt = List of amplitude hyperparameter values % fdt = List of final function value evaluation % % % (C) Gaussian Process SSTS Toolbox 1.0 % (C) Copyright 2006-2007, Keith Neo % http://www.hamilton.ie k_disp=0; % if "1", show display, else no display. % dn=floor(sqrt(6/g)/(MT(2)-MT(1))); % 6 used because of 5% minimum value. % dn=2*floor(sqrt(6/g)/(MT(2)-MT(1))); % This is last used, effective! dn=floor(sqrt(-2*log(per)/g)/(MT(2)-MT(1))); n=length(MT); ss_n=getord_vec(ord,(1:n)'); K=length(ss_n); gdt=zeros(K,1); vdt=zeros(K,1); adt=zeros(K,1); fdt=zeros(K,1); OPT=optimset('Display','off','GradObj','on','LargeScale','on','Hessian','on'); if (k_disp==1), figure(1),clf;hold on; end for k=1:K ind=ss_n(k); if (ind<=dn) tmpM=MT(1:ind+dn); tmpY=y(1:ind+dn); elseif ((n-ind)<=dn) tmpM=MT(ind-dn:n); tmpY=y(ind-dn:n); else tmpM=MT(ind-dn:ind+dn); tmpY=y(ind-dn:ind+dn); end xdt=[g;v]; [logmaxdt,fval]=fminunc('nolin_hess_optag',log(xdt),OPT,tmpM,tmpY); gdt(k)=exp(logmaxdt(1)); vdt(k)=exp(logmaxdt(2)); adt(k)=nolin_a(tmpM,tmpY,exp(logmaxdt)); fdt(k)=fval; if (k_disp==1) Q=diagadd(expacov(tmpM,tmpM,[1 gdt(k)]),vdt(k)); prt=tmpY-vdt(k)*(Q\tmpY); figure(1),plot(tmpM,tmpY,'x');plot(tmpM,prt,'r'); pause(0.01); end end if (k_disp==1), figure(1),hold off; end