In this tutorial, we describe how to include a new emulator to the surmise's framework. We illustrate this with PCGP
--an emulator method located in the directory \emulationmethods
.
In surmise, all emulator methods inherit from the base class :pysurmise.emulation.emulator
. An emulator class calls the user input method, and fits the corresponding emulator. :pysurmise.emulation.emulator.fit
and :pysurmise.emulation.emulator.predict
are the main :pysurmise.emulation.emulator
class methods. It also provides the functionality of updating and manipulating the fitted emulator by :pysurmise.emulation.emulator.supplement
, :pysurmise.emulation.emulator.update
, and :pysurmise.emulation.emulator.remove
class methods.
In order to use the functionality of the base class :pysurmise.emulation.emulator
, we categorize the functions to be included into a new emulation method (for example PCGP
) into two categories.
:pyfit
and :pypredict
are the two obligatory functions for an emulation method. :pyfit
takes the inputs X, parameters θ, and the function evaluations f, where X ∈ ℝN × p, θ ∈ ℝM × d, and f ∈ ℝN × M. In other words, each column in f should correspond to a row in θ. Each row in f should correspond to a row in X. In addition, the dictionary fitinfo
is passed to the :pyfit
function to place the fitting information once complete. This dictionary is used keep the information that will be used by :pypredict
below.
The :pyPCGP.fit
is given below for an illustration:
PCGP
fit
Once the base class :pysurmise.emulation.emulator
is initialized, :pysurmise.emulation.emulator.fit
method calls the developer's emulator's :pyfit
function, and places all information into the dictionary fitinfo
.
predict
:pysurmise.emulation.emulator.predict
method returns a prediction class object, which has methods :pysurmise.emulation.prediction.mean
, :pysurmise.emulation.prediction.mean_gradtheta
, :pysurmise.emulation.prediction.var
, :pysurmise.emulation.prediction.covx
, :pysurmise.emulation.prediction.covxhalf
, :pysurmise.emulation.prediction.covxhalf_gradtheta
, :pysurmise.emulation.prediction.rnd
, and :pysurmise.emulation.prediction.lpdf
.
Those expressions are defined within the base class to simplify the usage of the fitted models. In order to use those methods, the emulation method developers should either include functions :pypredictmean
, :pypredictmean_gradtheta
, :pypredictvar
, :pypredictcovx
, :pypredictcovxhalf
, :pypredictcovxhalf_gradtheta
, :pypredictrnd
, and :pypredictlpdf
into their methods, or define within the dictionary fitinfo
using the keys mean
, mean_gradtheta
, var
, covx
, covxhalf
, covxhalf_gradtheta
, rnd
, and lpdf
.
supplementtheta()
is an optional function for an emulation method.