# Variable fidelity Surrogates

With the variable fidelity surrogate, we can specify two different surrogates: one for high fidelity data and one for low fidelity data. By default, the first half samples are considered high fidelity and the second half low fidelity.

using Surrogates
using Plots
default()
n = 20
lower_bound = 1.0
upper_bound = 6.0
x = sample(n,lower_bound,upper_bound,SobolSample())
f = x -> 1/3*x
y = f.(x)
plot(x, y, seriestype=:scatter, label="Sampled points", xlims=(lower_bound, upper_bound), legend=:top)
plot!(f, label="True function",  xlims=(lower_bound, upper_bound), legend=:top)
varfid = VariableFidelitySurrogate(x,y,lower_bound,upper_bound)
(::VariableFidelitySurrogate{Vector{Float64}, Vector{Float64}, Float64, Float64, Int64, RadialBasis{Surrogates.var"#1#2", Int64, Vector{Float64}, Vector{Float64}, Float64, Float64, LinearAlgebra.Transpose{Float64, Vector{Float64}}, Float64, Bool}, RadialBasis{Surrogates.var"#3#4", Int64, Vector{Float64}, Vector{Float64}, Float64, Float64, LinearAlgebra.Transpose{Float64, Vector{Float64}}, Float64, Bool}}) (generic function with 1 method)
plot(x, y, seriestype=:scatter, label="Sampled points", xlims=(lower_bound, upper_bound), legend=:top)
plot!(f, label="True function",  xlims=(lower_bound, upper_bound), legend=:top)
plot!(varfid, label="Surrogate function",  xlims=(lower_bound, upper_bound), legend=:top)