-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmeanPosteriorMultiRun.m
46 lines (40 loc) · 1.23 KB
/
meanPosteriorMultiRun.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
45
46
% MATLAB function meanPosteriorMultiRun
%
% Alexandre Noll Marques
% MIT
%
% This function evalutaes the mean of a posterior Gaussian process
% associated with a multi-run model, as described in AIAA Journal paper
% AIAAJ_2016-11-J055877
%
% -------------------------------------------------------------------------
%
% User inputs:
%
% xe: real vector, values at which the samples are computed
%
% pos: struct, contains the information about the trained multi-run model
%
% input: integer, selects which component of the multi-run model is sampled
%
% -------------------------------------------------------------------------
function mean = meanPosteriorMultiRun(xe,pos,input)
nTask = numel(pos.x);
nEstimate = numel(xe);
nTraining = size(pos.U,2);
Ket = zeros(nEstimate,nTraining);
col = 0;
for task = 1:nTask
nPoint_task = size(pos.x{task},2);
points = pos.x{task}(input,:);
col = col(end) + (1:nPoint_task);
Ket(:,col) = Ket(:,col) + pos.k{input,1}(xe,points,pos.theta{input});
end
nParameter = pos.m{input,2};
if nParameter > 0
Me = pos.m{input,1}(xe,pos.beta{input});
else
Me = pos.m{input,1}(xe);
end
Kee = pos.k{input,1}(xe,[],pos.theta{input});
mean = Me' + Ket*pos.mean;