-
Notifications
You must be signed in to change notification settings - Fork 1
/
Kriging_predictor_mixed.m
46 lines (27 loc) · 1.13 KB
/
Kriging_predictor_mixed.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
function [pred_mean, pred_variance] = Kriging_predictor_mixed(x_pre,model)
% Kriging model predictor
%% Preparation
corr_fun = model.corr_fun;
u_pre = x_pre;
weight = model.weight;
y = model.orig_output;
switch corr_fun
case 'corrgaussian'
corrvector = Gaussian_corrvector(u_pre,model,'off'); % Correlation vector
case 'corrspline'
corrvector = Spline_corrvector(u_pre,model,'off'); % Correlation vector
case 'corrbiquadspline'
corrvector = Biquadspline_corrvector(u_pre,model,'off'); % Reduced correlation matrix
end
%% Prediction
u = model.tran_input;
corrvector = (1-weight)*corrvector + weight*u_pre*u'; % Mixed kernel
upper_mat = model.upper_mat;
sigma2 = model.sigma2;
mean = corrvector*(upper_mat\(upper_mat'\y)); % Kriging prediction mean
rt = upper_mat'\corrvector';
variance = sigma2*((1-weight)+weight*u_pre*u_pre'- sum(rt.^2) )';
% variance = ((1-weight)+weight*u_pre*u_pre'- sum(rt.^2) )';
pred_mean = mean; % Original prediction mean
pred_variance = variance; % Original prediction variance
end