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
+21-2Lines changed: 21 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,7 +68,7 @@ AbstractMCMC.MCMCSerial
68
68
## Common keyword arguments
69
69
70
70
Common keyword arguments for regular and parallel sampling are:
71
-
-`progress` (default: `AbstractMCMC.PROGRESS[]` which is `true` initially): toggles progress logging
71
+
-`progress` (default: `AbstractMCMC.PROGRESS[]` which is `true` initially): toggles progress logging. See the section on [Progress logging](#progress-logging) below for more details.
72
72
-`chain_type` (default: `Any`): determines the type of the returned chain
73
73
-`callback` (default: `nothing`): if `callback !== nothing`, then
74
74
`callback(rng, model, sampler, sample, iteration)` is called after every sampling step,
@@ -90,12 +90,31 @@ However, multiple packages such as [EllipticalSliceSampling.jl](https://github.c
90
90
To ensure that sampling multiple chains "just works" when sampling of a single chain is implemented, [we decided to support `initial_params` in the default implementations of the ensemble methods](https://github.com/TuringLang/AbstractMCMC.jl/pull/94):
91
91
-`initial_params` (default: `nothing`): if `initial_params isa AbstractArray`, then the `i`th element of `initial_params` is used as initial parameters of the `i`th chain. If one wants to use the same initial parameters `x` for every chain, one can specify e.g. `initial_params = FillArrays.Fill(x, N)`.
92
92
93
-
Progress logging can be enabled and disabled globally with `AbstractMCMC.setprogress!(progress)`.
93
+
## Progress logging
94
+
95
+
The default value for the `progress` keyword argument is `AbstractMCMC.PROGRESS[]`, which is always set to `true` unless modified with `AbstractMCMC.setprogress!`.
96
+
For example, `setprogress!(false)` will disable all progress logging.
94
97
95
98
```@docs
96
99
AbstractMCMC.setprogress!
97
100
```
98
101
102
+
For single-chain sampling (i.e., `sample([rng,] model, sampler, N)`), as well as multiple-chain sampling with `MCMCSerial`, the `progress` keyword argument should be a `Bool`.
103
+
104
+
For multiple-chain sampling using `MCMCThreads`, there are several, more detailed, options:
105
+
106
+
-`:perchain`: create one progress bar per chain being sampled
107
+
-`:overall`: create one progress bar for the overall sampling process, which tracks the percentage of samples that have been sampled across all chains
108
+
-`:none`: do not create any progress bar
109
+
-`true` (the default): use `perchain` for 10 or fewer chains, and `overall` for more than 10 chains
110
+
-`false`: same as `none`, i.e. no progress bar
111
+
112
+
The threshold of 10 chains can be changed using `AbstractMCMC.setmaxchainsprogress!(N)`, which will cause `MCMCThreads` to use `:perchain` for `N` or fewer chains, and `:overall` for more than `N` chains.
113
+
Thus, for example, if you _always_ want to use `:overall`, you can call `AbstractMCMC.setmaxchainsprogress!(0)`.
114
+
115
+
Multiple-chain sampling using `MCMCDistributed` behaves the same as `MCMCThreads`, except that `:perchain` is not (yet?) implemented.
116
+
So, `true` always corresponds to `:overall`, and `false` corresponds to `:none`.
117
+
99
118
## Chains
100
119
101
120
The `chain_type` keyword argument allows to set the type of the returned chain. A common
0 commit comments