comparison toolboxes/FullBNT-1.0.7/netlab3.3/gpcovar.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function [cov, covf] = gpcovar(net, x)
2 %GPCOVAR Calculate the covariance for a Gaussian Process.
3 %
4 % Description
5 %
6 % COV = GPCOVAR(NET, X) takes a Gaussian Process data structure NET
7 % together with a matrix X of input vectors, and computes the
8 % covariance matrix COV. The inverse of this matrix is used when
9 % calculating the mean and variance of the predictions made by NET.
10 %
11 % [COV, COVF] = GPCOVAR(NET, X) also generates the covariance matrix
12 % due to the covariance function specified by NET.COVARFN as calculated
13 % by GPCOVARF.
14 %
15 % See also
16 % GP, GPPAK, GPUNPAK, GPCOVARP, GPCOVARF, GPFWD, GPERR, GPGRAD
17 %
18
19 % Copyright (c) Ian T Nabney (1996-2001)
20
21 % Check arguments for consistency
22 errstring = consist(net, 'gp', x);
23 if ~isempty(errstring);
24 error(errstring);
25 end
26
27 ndata = size(x, 1);
28
29 % Compute prior covariance
30 if nargout >= 2
31 [covp, covf] = gpcovarp(net, x, x);
32 else
33 covp = gpcovarp(net, x, x);
34 end
35
36 % Add output noise variance
37 cov = covp + (net.min_noise + exp(net.noise))*eye(ndata);
38