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