Closed avehtari closed 3 weeks ago
brms already implements vectorization for many families, but I didn't activate it for beta_binomial yet, presumably because initially, no vectorized version existed. I will fix this quickly.
Should now be fixed :-)
There can be a huge difference in sampling speed with non-vectorized and vectorized code.
Simulated data
Short run
takes 812s in my laptop.
Using
make_stancode()
and changingto
and then the sampling takes 2s. This is 400x speedup.
I have a bit more complex model where the sampling for the vectorized version takes 90s, and based on a over-night run which did not yet finish, the expected sampling time with default vectorized version is 5 days. In this case, there is 5000x speedup.
If the vectorized form doesn't work for everything, it would be great to have an option to switch to the vectorized form with an explicit argument, which would make it much easier to get the speed-up without manual editing of the code and figuring out how to get the results back to brms object.