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
fit_hmc <- update(fit_compile, chains = 4, iter = 2000)
156
168
time_hmc <- proc.time() - t
157
169
```
158
170
@@ -163,27 +175,25 @@ To match the four Markov chains of length 1000 in HMC above, we then draw 4000 s
163
175
164
176
```{r results='hide'}
165
177
t <- proc.time()
166
-
fit_laplace <- epidist(
167
-
data = data, algorithm = "laplace", draws = 4000, backend = "cmdstanr"
178
+
fit_laplace <- update(
179
+
fit_compile, algorithm = "laplace", draws = 4000
168
180
)
169
181
time_laplace <- proc.time() - t
170
182
171
183
t <- proc.time()
172
-
fit_advi <- epidist(
173
-
data = data, algorithm = "meanfield", draws = 4000, backend = "cmdstanr"
184
+
fit_advi <- update(
185
+
fit_compile, algorithm = "meanfield", draws = 4000
174
186
)
175
187
time_advi <- proc.time() - t
176
188
```
177
189
178
190
For the Pathfinder algorithm we will set `num_paths = 1`.
179
-
Although both the Laplace and ADVI methods ran without problems in all cases during testing, we found that Pathfinder often produced the error message "Error evaluating model log probability: Non-finite gradient."
180
-
Although a `save_single_paths` option is available, which may have allowed recovery of individual Pathfinder paths (and therefore removing faulty paths), it does not appear to be working currently^[See https://github.com/stan-dev/cmdstanr/issues/878].
181
191
182
-
```{r}
192
+
```{r results='hide'}
183
193
t <- proc.time()
184
-
fit_pathfinder <- epidist(
185
-
data = data, algorithm = "pathfinder", draws = 4000, chains = 1,
186
-
backend = "cmdstanr"
194
+
fit_pathfinder <- update(
195
+
fit_compile, algorithm = "pathfinder", draws = 4000,
196
+
chains = 1
187
197
)
188
198
time_pathfinder <- proc.time() - t
189
199
```
@@ -307,7 +317,6 @@ times
307
317
308
318
The range of alternative approximation algorithms available, and their ease of use, is an attractive feature of `brms`.
309
319
We found that these algorithms do produce reasonable approximations in far less time than HMC.
310
-
Of course, this vignette only includes one example, and a more thorough investigation would be required to make specific recommendations.
311
-
That said, currently we do not recommend use of the Pathfinder algorithm due to its unstable performance in our testing and early stage software implementation.
320
+
Of course, this vignette only includes one example, so results may differ for other models and datasets.
0 commit comments