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
Copy file name to clipboardExpand all lines: docs/src/api.md
+7-1
Original file line number
Diff line number
Diff line change
@@ -121,7 +121,13 @@ To make it a bit easier to interact with some arbitrary sampler state, we encour
121
121
AbstractMCMC.getparams
122
122
AbstractMCMC.setparams!!
123
123
```
124
-
These methods can also be useful for implementing samplers which wraps some inner samplers, e.g. a mixture of samplers.
124
+
`getparams` and `setparams!!` provide a generic interface for interacting with the parameters of a sampler's state, regardless of how that state is represented internally.
125
+
126
+
This allows generic code to be written that works with any sampler implementing this interface. For example, a generic ensemble sampler could use `getparams` to extract the parameters from each of its component samplers' states, and `setparams!!` to initialize each component sampler with a different set of parameters.
127
+
128
+
The optional `model` argument to these functions allows sampler implementations to customize their behavior based on the model being used. For example, some samplers may need to evaluate the log density at new parameter values when setting parameters, which requires access to the model. If access to `model` is not needed, the sampler only needs to implement the version without the `model` argument - the default implementations will then call those methods directly.
129
+
130
+
These methods are particularly useful for implementing samplers which wrap some inner samplers, such as a mixture of samplers. In the next section, we will see how `getparams` and `setparams!!` can be used to implement a `MixtureSampler`.
0 commit comments