Utilities
AutoGP.Callbacks
AutoGP.Callbacks
— ModuleUtilities for creating callbacks to inspect SMC inference.
AutoGP.Callbacks.make_smc_callback
— Methodmake_smc_callback(fn::Function, model::AutoGP.GPModel; kwargs...)
Convert fn
into a callback for AutoGP.fit_smc!
(model, ...)
.
The function fn
must have a signature of the form fn(; [<opt>,] kw...)
, where kw...
is a varargs specifier and <opt>
denotes a (possibly empty) collection of required and optional keyword arguments.
For example fn(; a, b=2, kw...)
is valid because fn
takes no named arguments and the varargs specifier kw...
is present. If fn
includes named keyword arguments (i.e. a
and b
), then all required keyword arguments (i.e., a
) must be provided in the call to make_smc_callback
and optional keyword arguments (i.e., b
) may be provided, as shown in the examples below.
model = AutoGP.GPModel(...)
fn = (; a, b=2, kw...) -> ...
make_smc_callback(fn, model; a=2) # valid, `a` specified, `b` optional.
make_smc_callback(fn, model; a=1, b=2) # valid, `a` and `b` are specified.
make_smc_callback(fn, model) # invalid, `a` required but not specified.
make_smc_callback(fn, model; b=2) # invalid, `a` required but not specified.
The callback return by make_smc_callback
is guaranteed to receive in its varargs (which we called kw
) an "SMC" state which. The following variables can be accessed in the body of fn
by indexing kw
:
kw[:step]::Integer
: Current SMC step.kw[:model]::AutoGP.GPModel
: Inferred model at current SMC step.kw[:ds_next]::AutoGP.IndexType
: Futureds
(time points) to be observed in later SMC rounds.kw[:y_next]::Vector{<:Real}
: Futurey
(observations) to be observed in later SMC rounds.kw[:rejuvenated]::Bool
: Did rejuvenation occur at current step?kw[:resampled]:Bool
: Did resampling occur at current step?kw[:elapsed]::Float64
: Wall-clock inference runtime elapsed.kw[:verbose]::Bool
: Verbose setting.kw[:schedule]::Vector{Integer}
: The SMC data annealing schedule.kw[:permutation]::Vector{Integer}
: Indexes used to shuffle (model.ds
,model.y
).
AutoGP.Schedule
AutoGP.Schedule.linear_schedule
AutoGP.Schedule.logarithmic_schedule
AutoGP.Schedule.logarithmic_schedule
AutoGP.Schedule
— ModuleUtilities for creating SMC annealing schedules, used for AutoGP.fit_smc!
.
AutoGP.Schedule.linear_schedule
— Methodlinear_schedule(n::Integer, percent::Float64)
Adds roughly n⋅percent
new observations at each step.
AutoGP.Schedule.logarithmic_schedule
— Methodlogarithmic_schedule(n::Integer, base::Integer, start::Integer)
The first step adds start
observations (must be positive). At step i
, start⋅baseⁱ
new observations are added.
AutoGP.Schedule.logarithmic_schedule
— Methodlogarithmic_schedule(n::Integer, base::Real)
The total number of observations at step i
is baseⁱ
AutoGP.Transforms
AutoGP.Transforms
— ModuleUtilities for creating transformations.
AutoGP.Transforms.LinearTransform
— MethodLinearTransform(data::Vector{<:Real}, lo, hi)
Transform such that minimum(data) = lo
and maximum(data)=hi
.
AutoGP.Transforms.LinearTransform
— MethodLinearTransform(data::Vector{<:Real}, width)
Transform such that mean(data) = 0
and data
is within [-width, width]
.