annotate toolboxes/FullBNT-1.0.7/netlab3.3/gpcovar.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function [cov, covf] = gpcovar(net, x)
Daniel@0 2 %GPCOVAR Calculate the covariance for a Gaussian Process.
Daniel@0 3 %
Daniel@0 4 % Description
Daniel@0 5 %
Daniel@0 6 % COV = GPCOVAR(NET, X) takes a Gaussian Process data structure NET
Daniel@0 7 % together with a matrix X of input vectors, and computes the
Daniel@0 8 % covariance matrix COV. The inverse of this matrix is used when
Daniel@0 9 % calculating the mean and variance of the predictions made by NET.
Daniel@0 10 %
Daniel@0 11 % [COV, COVF] = GPCOVAR(NET, X) also generates the covariance matrix
Daniel@0 12 % due to the covariance function specified by NET.COVARFN as calculated
Daniel@0 13 % by GPCOVARF.
Daniel@0 14 %
Daniel@0 15 % See also
Daniel@0 16 % GP, GPPAK, GPUNPAK, GPCOVARP, GPCOVARF, GPFWD, GPERR, GPGRAD
Daniel@0 17 %
Daniel@0 18
Daniel@0 19 % Copyright (c) Ian T Nabney (1996-2001)
Daniel@0 20
Daniel@0 21 % Check arguments for consistency
Daniel@0 22 errstring = consist(net, 'gp', x);
Daniel@0 23 if ~isempty(errstring);
Daniel@0 24 error(errstring);
Daniel@0 25 end
Daniel@0 26
Daniel@0 27 ndata = size(x, 1);
Daniel@0 28
Daniel@0 29 % Compute prior covariance
Daniel@0 30 if nargout >= 2
Daniel@0 31 [covp, covf] = gpcovarp(net, x, x);
Daniel@0 32 else
Daniel@0 33 covp = gpcovarp(net, x, x);
Daniel@0 34 end
Daniel@0 35
Daniel@0 36 % Add output noise variance
Daniel@0 37 cov = covp + (net.min_noise + exp(net.noise))*eye(ndata);
Daniel@0 38