You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
InitContext, part 4 - Use init!! to replace evaluate_and_sample!!, predict, returned, and initialize_values (#984)
* Replace `evaluate_and_sample!!` -> `init!!`
* Use `ParamsInit` for `predict`; remove `setval_and_resample!` and friends
* Use `init!!` for initialisation
* Paper over the `Sampling->Init` context stack (pending removal of SamplingContext)
* Remove SamplingContext from JETExt to avoid triggering `Sampling->Init` pathway
* Remove `predict` on vector of VarInfo
* Fix some tests
* Remove duplicated test
* Simplify context testing
* Rename FooInit -> InitFromFoo
* Fix JETExt
* Fix JETExt properly
* Fix tests
* Improve comments
* Remove duplicated tests
* Docstring improvements
Co-authored-by: Markus Hauru <[email protected]>
* Concretise `chain_sample_to_varname_dict` using chain value type
* Clarify testset name
* Re-add comment that shouldn't have vanished
* Fix stale Requires dep
* Fix default_varinfo/initialisation for odd models
* Add comment to src/sampler.jl
Co-authored-by: Markus Hauru <[email protected]>
---------
Co-authored-by: Markus Hauru <[email protected]>
Copy file name to clipboardExpand all lines: docs/src/api.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -447,11 +447,6 @@ AbstractPPL.evaluate!!
447
447
448
448
This method mutates the `varinfo` used for execution.
449
449
By default, it does not perform any actual sampling: it only evaluates the model using the values of the variables that are already in the `varinfo`.
450
-
To perform sampling, you can either wrap `model.context` in a `SamplingContext`, or use this convenience method:
451
-
452
-
```@docs
453
-
DynamicPPL.evaluate_and_sample!!
454
-
```
455
450
456
451
The behaviour of a model execution can be changed with evaluation contexts, which are a field of the model.
457
452
Contexts are subtypes of `AbstractPPL.AbstractContext`.
@@ -466,7 +461,12 @@ InitContext
466
461
467
462
### VarInfo initialisation
468
463
469
-
`InitContext` is used to initialise, or overwrite, values in a VarInfo.
464
+
The function `init!!` is used to initialise, or overwrite, values in a VarInfo.
465
+
It is really a thin wrapper around using `evaluate!!` with an `InitContext`.
466
+
467
+
```@docs
468
+
DynamicPPL.init!!
469
+
```
470
470
471
471
To accomplish this, an initialisation _strategy_ is required, which defines how new values are to be obtained.
472
472
There are three concrete strategies provided in DynamicPPL:
@@ -505,7 +505,7 @@ The default implementation of [`Sampler`](@ref) uses the following unexported fu
505
505
```@docs
506
506
DynamicPPL.initialstep
507
507
DynamicPPL.loadstate
508
-
DynamicPPL.initialsampler
508
+
DynamicPPL.init_strategy
509
509
```
510
510
511
511
Finally, to specify which varinfo type a [`Sampler`](@ref) should use for a given [`Model`](@ref), this is specified by [`DynamicPPL.default_varinfo`](@ref) and can thus be overloaded for each `model`-`sampler` combination. This can be useful in cases where one has explicit knowledge that one type of varinfo will be more performant for the given `model` and `sampler`.
0 commit comments