forked from lawrennd/gpsim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgpsimCandidateLogLikeGradients.m
44 lines (35 loc) · 1.27 KB
/
gpsimCandidateLogLikeGradients.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
35
36
37
38
39
40
41
42
43
44
function [gParam, gX_u, gX] = gpsimCandidateLogLikeGradients(model, X, M, X_u)
% GPSIMCANDIDATELOGLIKEGRADIENTS Compute the gradients for the parameters of candidate genes.
% FORMAT
% DESC computes the gradients of the Gaussian process posterior
% likelihood with respect to the parameters of the model.
% ARG : model : the model structure for which gradients are computed.
% RETURN gParam : the gradient of the log likelihood with respect to
% the model parameters.
%
% SEEALSO : gpsimAddCandidate, gpsimCandidateLogLikelihood, modelLogLikeGradients, fgplvmLogLikeGradients
%
% COPYRIGHT : Neil D. Lawrence, 2007
% SHEFFIELDML
if nargin < 4
if nargin < 3
M = model.candidate.m;
end
if nargin < 2
t = model.candidate.t;
end
end
gX_u = [];
gX = [];
%g_scaleBias = gpScaleBiasGradient(model);
if isfield(model, 'meanFunction') & ~isempty(model.meanFunction)
g_meanFunc = gpMeanFunctionGradient(model);
else
g_meanFunc = [];
end
[gK_uf, gK_star] = gpsimCandidateCovGrads(model, M);
%%% Compute Gradients of Kernel Parameters %%%
g_param = kernGradient(model.candidate.kern, model.candidate.t, model.t, gK_uf);
% deal with diagonal term's affect on kernel parameters.
g_param = g_param + kernGradient(model.candidate.kern, model.t, gK_star);
% Need to deal with mean!