API
SurrogatesBase.AbstractDeterministicSurrogate
— Typeabstract type AbstractDeterministicSurrogate <: Function end
An abstract type for deterministic surrogates.
(s::AbstractDeterministicSurrogate)(xs)
Subtypes of AbstractDeterministicSurrogate
are callable with a Vector
of points xs
. The result is a Vector
of evaluations of the surrogate at points xs
, corresponding to approximations of the underlying function at points xs
respectively.
Examples
julia> struct ZeroSurrogate <: AbstractDeterministicSurrogate end
julia> (::ZeroSurrogate)(xs) = 0
julia> s = ZeroSurrogate();
julia> s([4]) == 0
true
SurrogatesBase.AbstractStochasticSurrogate
— Typeabstract type AbstractStochasticSurrogate end
An abstract type for stochastic surrogates.
See also finite_posterior
.
SurrogatesBase.finite_posterior
— Functionfinite_posterior(s::AbstractStochasticSurrogate, xs::AbstractVector)
Return a posterior distribution at points xs
.
An AbstractStochasticSurrogate
might implement some or all of the following methods on the returned object:
mean(finite_posterior(s,xs))
returns aVector
of posterior means atxs
var(finite_posterior(s,xs))
returns aVector
of posterior variances atxs
mean_and_var(finite_posterior(s,xs))
returns aTuple
consisting of aVector
of posterior means and aVector
of posterior variances atxs
rand(finite_posterior(s,xs))
returns aVector
, which is a sample from the joint
posterior at points xs
Use mean(finite_posterior(s, eachslice(X, dims = 2)))
if X
is a matrix.
SurrogatesBase.hyperparameters
— FunctionSurrogatesBase.parameters
— Functionparameters(s)
Returns current values of parameters used in surrogate s
.
SurrogatesBase.update!
— Functionupdate!(s, new_xs::AbstractVector, new_ys::AbstractVector)
Include data new_ys
at points new_xs
into the surrogate s
, i.e., refit the surrogate s
to incorporate new data points.
If the surrogate s
is a deterministic surrogate, the new_ys
correspond to function evaluations, if s
is a stochastic surrogate, the new_ys
are samples from a conditional probability distribution.
Use update!(s, eachslice(X, dims = 2), new_ys)
if X
is a matrix.
SurrogatesBase.update_hyperparameters!
— Functionupdate_hyperparameters!(s, prior)
Update the hyperparameters of the surrogate s
by performing hyperparameter optimization using the information in prior
. After changing hyperparameters of s
, fit s
to past data.
See also hyperparameters
.