Indeed it’s very slow on my machine as well.
I noticed a few things:
- Both lam and m inside the trend_model are for the same thing, global mean. You only need one of them. I set m to zero
- For lam, the global mean, do you need the hyper-priors a&b? Not sure what information they will add, I would change lam to something like HalfNormal(10.). If you do want to keep the hyper priors then you need to ensure a and b are strictly positive.
- The seasonality prior scale is quite wide, try lowering to 5 or 2
- Use theano function where possible over numpy.
import theano.tensor as tt
def fourier_series(t, p=365.25, n=10):
# 2 pi n / p
x = 2 * np.pi * tt.arange(1, n + 1) / p
# 2 pi n / p * t
x = x * t[:, None]
x = tt.concatenate((tt.cos(x), tt.sin(x)), axis=1)
return x
- You have 25 change points, your (fake) data doesn’t have any trends, perhaps lower the number of changepoints.
- Do you need such high orders on the fourier series? You have yearly order=10, weekly-3 and daily-4.
Even after all these the sampler still estimates a run time of a couple of hours for me.