@@ -31,7 +31,7 @@ using DistributionFits
3131
3232Next, specify many moving parts of the Hybrid variational inference (HVI)
3333
34- ## The process-based model
34+ ## The process-based model
3535The example process based model (PBM) predicts a double-monod constrained rate
3636for different substrate concentrations, ` S1 ` , and ` S2 ` .
3737
@@ -101,7 +101,7 @@ transM = Stacked(HVI.Exp(), HVI.Exp())
101101
102102Parameter transformations are specified using the ` Bijectors ` package.
103103Because, ` Bijectors.elementwise(exp) ` , has problems with automatic differentiation (AD)
104- on GPU, we use the non-exported [ ` Exp ` ] ( ) wrapper inside ` Bijectors.Stacked ` .
104+ on GPU, we use the public but non-exported [ ` Exp ` ] ( @ref ) wrapper inside ` Bijectors.Stacked ` .
105105
106106### Prior information on parameters at constrained scale
107107
@@ -130,16 +130,16 @@ Here, we use synthetic data generated by the package.
130130
131131``` {julia}
132132rng = StableRNG(111)
133- scenario = Val((:omit_r0, :covarK2, ))
134- (; xM, xP, y_o, y_unc) = gen_hybridproblem_synthetic( rng, DoubleMM.DoubleMMCase(); scenario)
133+ (; xM, xP, y_o, y_unc) = gen_hybridproblem_synthetic(
134+ rng, DoubleMM.DoubleMMCase(); scenario=Val((:omit_r0,)) )
135135```
136136
137137``` {julia}
138138#| echo: false
139139#| eval: false
140140() -> begin
141141 (; xM, θP_true, θMs_true, xP, y_global_true, y_true, y_global_o, y_o, y_unc) =
142- gen_hybridproblem_synthetic(rng, DoubleMM.DoubleMMCase(); scenario)
142+ gen_hybridproblem_synthetic(rng, DoubleMM.DoubleMMCase(); scenario=Val((:omit_r0,)) )
143143end
144144```
145145
@@ -265,7 +265,7 @@ y1 = f_batch(CA.getdata(θP), CA.getdata(θMs), CA.getdata(x_batch))[2]
265265 #using Cthulhu
266266 #@descend_code_warntype f_batch(CA.getdata(θP), CA.getdata(θMs), CA.getdata(x_batch))
267267 prob0 = HVI.DoubleMM.DoubleMMCase()
268- f_batch0 = get_hybridproblem_PBmodel(prob0; scenario, use_all_sites = false)
268+ f_batch0 = get_hybridproblem_PBmodel(prob0; use_all_sites = false)
269269 y1f = f_batch0(θP, θMs, x_batch)[2]
270270 y1 .- y1f # equal
271271end
@@ -352,17 +352,26 @@ epochs of the optimization.
352352
353353## Saving the results
354354Extracting useful information from the optimized HybridProblem is covered
355- in the following tutorial. XXLink
356-
357- In order to use the results from this tutorial in other tutorials,
355+ in the following [ Inspect results of fitted problem] ( @ref ) tutorial.
356+ In order to use the results from this tutorial in other tutorials,
358357the updated ` probo ` ` HybridProblem ` and the interpreters are saved to a JLD2 file.
359358
359+ Before the problem is updated to use the redefinition [ ` DoubleMM.f_doubleMM_sites ` ] ( @ref )
360+ of the PBM in module ` DoubleMM ` rather than
361+ module ` Main ` to allow for easier reloading with JLD2.
362+
363+ ``` {julia}
364+ f_batch = PBMPopulationApplicator(DoubleMM.f_doubleMM_sites, n_batch; θP, θM, θFix, xPvec=xP[:,1])
365+ f_allsites = PBMPopulationApplicator(DoubleMM.f_doubleMM_sites, n_site; θP, θM, θFix, xPvec=xP[:,1])
366+ probo2 = HybridProblem(probo; f_batch, f_allsites)
367+ ```
368+
360369``` {julia}
361370using JLD2
362371fname = "intermediate/basic_cpu_results.jld2"
363372mkpath("intermediate")
364- if probo isa AbstractHybridProblem # do not save on failure above
365- jldsave(fname, false, IOStream; probo, interpreters)
373+ if probo2 isa AbstractHybridProblem # do not save on failure above
374+ jldsave(fname, false, IOStream; probo=probo2 , interpreters)
366375end
367376```
368377
0 commit comments