@@ -115,6 +115,23 @@ DynamicPPL.unflatten(vi::SimpleVarInfo, θ::NamedTuple) = SimpleVarInfo(θ, vi.l
115115# Algorithm for sampling from the prior
116116struct Prior <: InferenceAlgorithm end
117117
118+ function AbstractMCMC. step (
119+ rng:: Random.AbstractRNG ,
120+ model:: DynamicPPL.Model ,
121+ sampler:: DynamicPPL.Sampler{<:Prior} ,
122+ state= nothing ;
123+ kwargs... ,
124+ )
125+ vi = last (DynamicPPL. evaluate!! (
126+ model,
127+ VarInfo (),
128+ SamplingContext (
129+ rng, DynamicPPL. SampleFromPrior (), DynamicPPL. PriorContext ()
130+ )
131+ ))
132+ return vi, nothing
133+ end
134+
118135"""
119136 mh_accept(logp_current::Real, logp_proposal::Real, log_proposal_ratio::Real)
120137
@@ -230,36 +247,6 @@ function AbstractMCMC.sample(
230247 chain_type= chain_type, progress= progress, kwargs... )
231248end
232249
233- function AbstractMCMC. sample (
234- rng:: AbstractRNG ,
235- model:: AbstractModel ,
236- alg:: Prior ,
237- ensemble:: AbstractMCMC.AbstractMCMCEnsemble ,
238- N:: Integer ,
239- n_chains:: Integer ;
240- chain_type= DynamicPPL. default_chain_type (alg),
241- progress= PROGRESS[],
242- kwargs...
243- )
244- return AbstractMCMC. sample (rng, model, SampleFromPrior (), ensemble, N, n_chains;
245- chain_type, progress, kwargs... )
246- end
247-
248- function AbstractMCMC. sample (
249- rng:: AbstractRNG ,
250- model:: AbstractModel ,
251- alg:: Prior ,
252- N:: Integer ;
253- chain_type= DynamicPPL. default_chain_type (alg),
254- resume_from= nothing ,
255- initial_state= DynamicPPL. loadstate (resume_from),
256- progress= PROGRESS[],
257- kwargs...
258- )
259- return AbstractMCMC. mcmcsample (rng, model, SampleFromPrior (), N;
260- chain_type, initial_state, progress, kwargs... )
261- end
262-
263250# #########################
264251# Chain making utilities #
265252# #########################
0 commit comments