Surrogate
Every surrogate has a different definition depending on the parameters needed. However, they have in common:
add_point!(::AbstractSurrogate,x_new,y_new)
AbstractSurrogate(value)
The first function adds a sample point to the surrogate, thus changing the internal coefficients. The second one calculates the approximation at value.
- Linear surrogate
Surrogates.LinearSurrogate
— Method.LinearSurrogate(x,y,lb,ub)
Builds a linear surrogate using GLM.jl
- Radial basis function surrogate
Surrogates.RadialBasis
— Method.RadialBasis(x,y,bounds,phi::Function,q::Int)
Constructor for RadialBasis surrogate
- (x,y): sampled points
- bounds: region of interest of the form [[a,b],[c,d],...,[w,z]]
- phi: radial basis of choice
- q: number of polynomial elements
- Kriging surrogate
Surrogates.Kriging
— Method.Kriging(x,y,p,theta)
Constructor for Kriging surrogate.
- (x,y): sampled points
- p: array of values 0<=p<2 modelling the smoothness of the function being approximated in the i-th variable. low p -> rough, high p -> smooth
- theta: array of values > 0 modellig how much the function is changing in the i-th variable
- Lobachesky surrogate
Surrogates.LobacheskySurrogate
— Method.LobacheskySurrogate(x,y,alpha,n::Int,lb,ub)
Build the Lobachesky surrogate with parameters alpha and n.
Surrogates.lobachesky_integral
— Method.lobachesky_integral(loba::LobacheskySurrogate,lb,ub)
Calculates the integral of the Lobachesky surrogate, which has a closed form.
- Support vector machine surrogate
Surrogates.SVMSurrogate
— Method.SVMSurrogate(x,y,lb,ub)
Builds SVM surrogate.
- Random forest surrogate
Surrogates.RandomForestSurrogate
— Method.RandomForestSurrogate(x,y,lb,ub,num_round)
Build Random forest surrogate. num_round is the number of trees.
- Neural network surrogate
Surrogates.NeuralSurrogate
— Method.NeuralSurrogate(x,y,lb,ub,model,loss,opt,n_echos)
- model: Flux layers
- loss: loss function
- opt: optimization function
Creating another surrogate
It's great that you want to add another surrogate to the library! You will need to:
- Define a new mutable struct and a constructor function
- Define add_point!(your_surrogate::AbstactSurrogate,x_new,y_new)
- Define your_surrogate(value) for the approximation
Example
mutable struct NewSurrogate{X,Y,L,U,C,A,B} <: AbstractSurrogate
x::X
y::Y
lb::L
ub::U
coeff::C
alpha::A
beta::B
end
function NewSurrogate(x,y,lb,ub,parameters)
...
return NewSurrogate(x,y,lb,ub,calculated\_coeff,alpha,beta)
end
function add_point!(NewSurrogate,x\_new,y\_new)
nothing
end
function NewSurrogate(value)
return NewSurrogate.coeff*value + NewSurrogate.alpha
end