Invalid dimension for value: 0

Hi there,
I want to model an underlying function f:
f ~ MvN(mu, Sigma), where Sigma is fixed.
and I assume that my observations y are i.i.d with Gaussian Noise:
y_i ~ N(f_i, eps)

I tried:

with pm.Model() as model:         
   epsilon = pm.HalfNormal('epsilon', sd=1)
   fs = pm.MvNormal('fs', mu=tt.zeros(len(ys)), cov=Sigma)
   ys = pm.MvNormal('ys', mu=fs, cov=epsilon*tt.eye(len(fs)), observed=ys)
   # or: ys = pm.Normal('ys', mu=fs, sd=epsilon, shape=len(_ys), observed=ys)
   print(pm.find_MAP())

which yields the error “Invalid dimension for value: 0”. ys has shape (n,)
I tried different things and cannot get it to work. I’d be very thankful for some help :slight_smile:

I believe the answer is here: https://stackoverflow.com/questions/56417787/constructing-a-multivariate-normal-distribution-with-probabilistic-parameters-in

2 Likes