Thank you. What does t_ = pm.MutableData('t', t) become in terms of type of object when I define them inside the model?
When I try to get len(t_), I get an error
TypeError: object of type 'TensorSharedVariable' has no len()
But I need the length for these parts of the code:
yearly_beta = pm.Normal('yearly_beta', 0, 1, shape = n_components*2)
yearly_seasonality = pm.Deterministic('yearly_seasonality',at.dot(yearly_X(t_, 365.25/**len(t_)**), yearly_beta))
monthly_beta = pm.Normal('monthly_beta', 0, 1, shape = monthly_n_components*2)
monthly_seasonality = pm.Deterministic('monthly_seasonality',at.dot(monthly_X(t_, 30.5/**len(t_)**), monthly_beta))
UPDATE:
I don’t think it’s the len. I did the following:
len_t = pm.ConstantData('len_t', len(t)). Then I got the following error:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/tmp/ipykernel_5309/1167067047.py in <module>
16
17 yearly_beta = pm.Normal('yearly_beta', 0, 1, shape = n_components*2)
---> 18 yearly_seasonality = pm.Deterministic('yearly_seasonality',at.dot(yearly_X(t_, 365.25/len(t)), yearly_beta))
19
20 monthly_beta = pm.Normal('monthly_beta', 0, 1, shape = monthly_n_components*2)
/tmp/ipykernel_5309/3136029572.py in yearly_X(t, p, n)
9 def yearly_X(t, p=365.25, n=n_components):
10 x = 2 * np.pi * (np.arange(n)+1) * t[:, None] / p
---> 11 return np.concatenate((np.cos(x), np.sin(x)), axis = 1)
12
13 monthly_n_components = 5
<__array_function__ internals> in concatenate(*args, **kwargs)
ValueError: zero-dimensional arrays cannot be concatenated
I think my fourier_seasonality function needs to be rewritten in aesara to be used with pm.Data object?