Hey thanks for the help! The first part definitely makes sense, but I’m a little confused about the second half. I definitely want a kx1 vector here. Are you saying instead of calling aesara.function, I should just use “results” in my deterministic function? When exactly would I call the function then in order to set my initial values and number of steps? I switched to this code and I’m getting “TypeError: ufunc ‘isnan’ not supported for the input types”.
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import pymc as pm
import aesara
import aesara.tensor as at
tweet_model = pm.Model()
with tweet_model:
alpha = pm.Uniform("alpha", lower=-30, upper=700)
beta = pm.LogNormal("beta", mu=0, sigma=2)
delta = pm.Beta("delta", alpha=5, beta=1)
k = at.iscalar("k")
v = at.iscalar("v")
outputs_info = at.as_tensor_variable(np.asarray(0, dtype='float64'))
result, updates = aesara.scan(fn=lambda prior_result: delta*prior_result + data.gamma(),
outputs_info=outputs_info,
n_steps=k)
# virality = aesara.function(inputs=[v,k], outputs=result, updates=updates)
shares = alpha*(pm.math.exp(beta*result) - 1/(result+1))
Y_obs = pm.Normal("Y_obs", mu=shares, sigma=1, observed=Y)
trace_g = pm.sample(2000, tune=1000, cores=2)