Map Training Routines
MParT.CreateGaussianKLObjective
— FunctionCreateGaussianKLObjective(train)
CreateGaussianKLObjective(train, outputDim)
CreateGaussianKLObjective(train, test)
CreateGaussianKLObjective(train, test, outputDim)
Create an objective for the optimization problem of training a transport map.
Currently only supports variational simulation-based inference, i.e. creating a map that uses samples train
from target distribution and a Gaussian reference distribution of dimension outputDim
. If outputDim
is zero, this is equivalent to when outputDim == size(train,1)
.
Arguments
train::Matrix{Float64}
: mandatory training datasettest::Matrix{Float64}
: optional test datasetoutputDim::Int = 0
: Dimensions of output of map
Examples
julia> using Random; rng = Random.Xoshiro(1);
julia> # Replace RNG type with MersenneTwister for <1.7
julia> N, inDim, outDim = 1000, 4, 2;
julia> samples = 2*randn(rng, inDim, N) .+ 5;
julia> obj1 = CreateGaussianKLObjective(samples);
julia> obj2 = CreateGaussianKLObjective(samples, outDim);
julia> train, test = samples[:,1:500], samples[:,501:end];
julia> obj3 = CreateGaussianKLObjective(train, test);
julia> obj4 = CreateGaussianKLObjective(train, test, outDim);
See also TrainMap
, TrainOptions
MParT.TrainOptions
— Function`TrainOptions(;kwargs...)`
Creates options for using TrainMap
to train a transport map.
See example for possible arguments.
Examples
julia> TrainOptions(opt_alg="LD_SLSQP", opt_maxeval = 1_000_000)
opt_alg = LD_SLSQP
opt_stopval = -inf
opt_ftol_rel = 0.001
opt_ftol_abs = 0.001
opt_xtol_rel = 0.0001
opt_xtol_abs = 0.0001
opt_maxeval = 1000000
opt_maxtime = inf
verbose = 0
See also TrainMap
, CreateGaussianKLObjective
MParT.TrainMap
— FunctionTrainMap(map, obj::MapObjective, opts::TrainOptions)
Trains map
according to the objective obj
with training options opts
.
MParT.TestError
— FunctionTestError(obj::MapObjective, map)
Uses the test dataset in obj to evaluate the error of map
.