I’m trying to reproduce the PymC3 AR(1) tutorial in PyMC4. Here is what I am trying to do.
import pymc4 as pm
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import arviz as az
np.random.seed(seed=42)
T = 100
y = np.zeros((T,))
for i in range(1,T):
y[i] = 0.95 * y[i-1] + np.random.normal()
y = y.reshape(len(y), -1)
#plt.plot(y);
@pm.model
def model(data):
x = yield pm.Normal(loc=0., scale=1., name="beta")
like = yield pm.AR(
name='like',
num_timesteps=100,
coefficients=[x],
level_scale=0.5,
observed_time_series=data)
return like
trace = pm.sample(model(y), num_samples=500)
However, it does not allow me to use x
as the coefficients and I’m getting the error:
TypeError: Value passed to parameter 'input' has DataType variant not in list of allowed values: float32, float64, int32, uint8, int16, int8, complex64, int64, qint8, quint8, qint32, bfloat16, uint16, complex128, float16, uint32, uint64
My aim is to add the AR(1) simulation example to pymc4/notebooks. Hope I have not missed any obvious guideline.