@@ -165,7 +165,7 @@ the problem below.
165165
166166### Providing data in batches
167167
168- HVI uses ` MLUtils.DataLoader ` to provide baches of the data during each
168+ HVI uses ` MLUtils.DataLoader ` to provide batches of the data during each
169169iteration of the solver. In addition to the data, it provides an
170170index to the sites inside a tuple.
171171
@@ -303,7 +303,7 @@ Then the solver is applied to the problem using [`solve`](@ref)
303303for a given number of iterations or epochs.
304304For this tutorial, we additionally specify that the function to transfer structures to
305305the GPU is the identity function, so that all stays on the CPU, and this tutorial
306- hence does not require ad GPU or GPU livraries .
306+ hence does not require ad GPU or GPU libraries .
307307
308308Among the return values are
309309- ` probo ` : A copy of the HybridProblem, with updated optimized parameters
@@ -312,7 +312,7 @@ Among the return values are
312312
313313## Using a population-level process-based model
314314
315- So far, the process-based model ram for each single site.
315+ So far, the process-based model ran for each single site.
316316For this simple model, some performance grains result from matrix-computations
317317when running the model for all sites within one batch simultaneously.
318318
@@ -324,13 +324,14 @@ one site. For the drivers and predictions, one column corresponds to one site.
324324
325325
326326``` {julia}
327+ using StaticArrays
327328function f_doubleMM_sites(θc::CA.ComponentMatrix, xPc::CA.ComponentMatrix)
328329 # extract several covariates from xP
329330 S1 = view(xPc, Val(:S1), :)
330331 S2 = view(xPc, Val(:S2), :)
331332 #
332333 # extract the parameters as row-repeated vectors
333- # θc[:,:r0] is paramter r0 for each site in batch
334+ # θc[:,:r0] is parameter r0 for each site in batch
334335 # dot-multiplication of full matrix times row-vector repeats for each observation row
335336 # also introduces zero for missing observations, leading to zero gradient there
336337 is_valid = isfinite.(S1) .&& isfinite.(S2)
344345```
345346
346347Again, the function should not rely on the order of parameters but use symbolic indexing
347- to extract the parameter vectors. For type stability of this symbolic indexing,
348- it uses a workaround to get the type of a single row.
349- Similarly, it uses type hints to index into the drivers, ` xPc ` , to extract
350- sub-matrices by symbols. Alternatively, here it could rely on the structure and
351- ordering of the columns in ` xPc ` .
348+ to extract the parameter vectors.
352349
353350A corresponding [ ` PBMPopulationApplicator ` ] ( @ref ) transforms calls with
354351partitioned global and site parameters to calls of this matrix version of the PBM.
@@ -360,11 +357,9 @@ probo_sites = HybridProblem(probo; f_batch)
360357```
361358
362359For numerical efficiency, the number of sites within one batch is part of the
363- ` PBMPopulationApplicator ` . Hence, we have two different functions, one applied
364- to a batch of site, and another applied to all sites.
365-
366- As a test of the new applicator, the results are refined by running a few more
367- epochs of the optimization.
360+ ` PBMPopulationApplicator ` . The problem stores an applicator for ` n_batch ` sites,
361+ however, an applicator for ` n_site_pred ` sites can be obtained by
362+ ` create_nsite_applicator(f_batch, n_site_pred) ` .
368363
369364``` {julia}
370365(; probo) = solve(probo_sites, solver; rng,
@@ -380,7 +375,7 @@ in the following [Inspect results of fitted problem](@ref) tutorial.
380375In order to use the results from this tutorial in other tutorials,
381376the updated ` probo ` ` HybridProblem ` and the interpreters are saved to a JLD2 file.
382377
383- Before the problem is updated to use the redefinition [ ` DoubleMM.f_doubleMM_sites ` ] ( @ref )
378+ Before the problem is updated, so that it uses the redefinition [ ` DoubleMM.f_doubleMM_sites ` ] ( @ref )
384379of the PBM in module ` DoubleMM ` rather than
385380module ` Main ` to allow for easier reloading with JLD2.
386381
0 commit comments