Hi, I was hoping for some help figuring out why this model is so slow. It only samples ~2 per second, so it takes a very long time to generate anything useful.
Here is the code. There are 30 teams each with an index in the dataset and the values of the observations are interger valued. This is supposed to be a state space model, which is why the latent variable is modeled as an AR1 (though bc. it’s multivariate I had to use AR rather than AR1).
Hey, Aditya_Kaushik. While giving a full explanation would take very long, I used to wonder the same thing myself and so I will save you a lot of time by just letting you know that Pymc3 does not do time series very well at the moment.
There is no inherent reason for this, other than that A) reparametrizing time-series efficiently is a difficult thing, and I believe Stan has much better time-series functionality purely because they accomplish this specific aspect better, and B) the samplers in use were not built for time-series to begin with (unlike SMC, which Pymc3 recently incorporated, but still needs some more work to handle time series as well as it hypothetically can), with reparametrizing only being a stop-gap to not having a dedicated sampler.
These are some things I picked up over time, but I may be wrong, and I hope other users/developers maybe can lend their opinions on the topic ^^; .
There are other threads around this forum, such as in here, that demonstrate similar findings. I wish you the best of luck!
Hi Gon_F, thank you very much for this response. You have saved me a lot of future headache. Would you recommend Stan in python/R for the type of analysis I want to perform then? Or are there libraries that you think are better.
For Bayesian time-series analysis, I would really only recommend Stan at the moment, there is not much else that is as flexible, and also fast enough to actually work. Stan takes more effort to work in, but there are enough examples on what you want to accomplish.
I haven’t actually play with the time series components in Stan, do they have some special API?
Otherwise, Bayesian state space model in tensorflow probability is really good in terms design (you can do almost every kind of time series using that) however it is currently a bit slow for large timeseries.