-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Description
Hi,
So I tried implementing the MetaSampler. Here's how I thought we could do it:
struct MetaSampler <: AbstractSampler
samplers::Dict{Symbol, AbstractSampler}
end
"""
MetaSampler(samplers::Pair{Symbol, <:AbstractSampler}...)
MetaSampler is a collection of Symbol => Sampler pairs. This is intended to be used by algorithm designers when they need different ways to sample a trajectory at various points in their implementation.
"""
MetaSampler(samplers::Pair{Symbol, <: AbstractSampler}...) = MetaSampler(Dict(samplers...))
Base.getindex(m::MetaSampler, idx) = m.samplers[idx]
The idea being that in the algorithm implementation one could use sample(trajectory.sampler[:policy], traces)
to switch between samplers in the MetaSampler. However I have two questions:
- I don't see
sample
in the exported API in the readme. Does that mean that the design is to only useiterate
?sample
is called bytake!
andtake!
is called by iterate. If we were to use sample directly, this would bypass the controler shenanigans, which is not desirable for ASync stuff. Perhaps we could implementtake!(trajectory, :policy)
(that is, the second argument is to specify a sampler. But it's weird to me to usetake!
as a sampling API. - Anyways, how can we integrate MetaSampler to the
iterate
API ? I don't think iterate can accept a Symbol option.
Metadata
Metadata
Assignees
Labels
No labels