forked from lawrennd/gpsim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgpsimMapUpdateYpredVar.m
42 lines (34 loc) · 1.13 KB
/
gpsimMapUpdateYpredVar.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
function model = gpsimMapUpdateYpredVar (model)
% GPSIMMAPUPDATEYPREDVAR Update the variance for y.
% FORMAT
% DESC updates the variance for y.
% ARG model : the model for which the variance for y is to be
% updated.
% RETURN model : the model with the variance of y.
%
% SEEALSO : gpsimMapCreate, gpsimMapUpdeteYpred
% COPYRIGHT : Pei Gao, Magnus Rattray and Neil D. Lawrence, 2008
% SHEFFIELDML
iter = 100;
for i = 1:iter
predModel.samp{i} = model;
f = model.f + sqrt(model.varf).* ...
randn(size(model.f));
% figure(1); hold on;
% plot(model.mapt, f);
predModel.samp{i} = gpsimMapFunctionalExpandParam(model, f');
% figure(2); hold on;
% plot(model.mapt, predModel.samp{i}.ypred(:,1));
for j = 1:model.numGenes
ypred{j}(:,i) = predModel.samp{i}.ypred(:,j);
end
end
for j = 1:model.numGenes
if isfield(model,'includeNoise') && model.includeNoise
ypredVar(:,j) = var(ypred{j},0,2) + model.noiseVar(j);
else
ypredVar(:,j) = var(ypred{j},0,2);
end
end
model.ypredVar = ypredVar;
% plot(model.mapt, model.ypred(:,1)-2*sqrt(ypredVar(:,1)), 'r-');