Chapter 2: Constructing a Surrogate

This text is written around the core problem of attempting to learn a mapping y=f(x) that lives in a black box, which obscures from us the physics that converts the vector into a scalar output y. This black box could take the form of either a physical or computer experiment, for example a finite element code, which calculates the maximum stress (f) for given product dimensions (x). The generic solution method is to collect the output values y(1),y(2),…,y(n) that result from a set of inputs x(1),x(2),…,x(n) and find a best guess ^f(x) for the black box mapping f, based on these known observations.

In this chapter we discuss the fundamentals and some of the technical minutiae of a number of specific surrogate model types capable of accomplishing this learning process. We begin, however, with a generic discussion of the key stages of the surrogate model building process.

To get started, download the Matlab toolbox, try one of the examples in the book and/or run an example script, e.g. `rbfexample.m`.

The Matlab code below creates a Kriging model of the ‘Branin function’ and produces the contour plot of the Kriging prediction at the top of this page.

% no. of dimensions
k=2;
% no. of sample points
n=20;

% set up global data structure
global ModelInfo

% space filling sample
ModelInfo.X=bestlh(n,k,20,10);

% observed data
for i=1:n
ModelInfo.y(i,:)=branin(ModelInfo.X(i,:));
end

% maximise likelihood
[ModelInfo.Theta,MinNegLnLikelihood]=ga(@likelihood,k,[],[],[],[],-3*ones(1,k),2*ones(1,k));
[NegLnLike,ModelInfo.Psi,ModelInfo.U]=likelihood(ModelInfo.Theta);

% plot Kriging model
xpred=0:1/20:1;
braninpred=zeros(21,21);
for i=1:21
for j=1:21
ModelInfo.Option=‘Pred’;
braninpred(i,j)=predictor([xpred(j) xpred(i)]);
end
end
figure
contourf(xpred,xpred,braninpred,20)
hold on
plot(ModelInfo.X(:,1),ModelInfo.X(:,2),‘k.’,‘MarkerSize’,20)