forked from lawrennd/gpsim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgpnddisimGradient.m
34 lines (27 loc) · 945 Bytes
/
gpnddisimGradient.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function g = gpnddisimGradient(params, model)
% GPDISIMGRADIENT Gradient wrapper for a GPDISIM model.
% FORMAT
% DESC wraps the log likelihood gradient function to return the
% gradient of the negative of the log likelihood. This can then be
% used in, for example, NETLAB, minimisation tools.
% ARG params : the parameters of the model.
% ARG model : the model for which gradients will be computed.
% RETURN g : the returned gradient of the negative log likelihood
% for the given parameters.
%
% SEEALSO : scg, conjgrad, gpsimCreate, gpsimObjective, gpsimLogLikeGradient, gpsimOptimise
%
% COPYRIGHT : Neil D. Lawrence, 2006
%
% COPYRIGHT : Antti Honkela, 2007
% GPSIM
try,
model = gpnddisimExpandParam(model, params);
g = - gpnddisimLogLikeGradients(model);
catch,
g = 0*gpnddisimLogLikeGradients(model);
end
%plotpredictions(model,[0:5:1280]',2,1,1,'exampletitle');
%drawnow;
%g
% g=-testModelGradientBasic(model,1,1);