I am putting together a network latent space model, but can’t get it to sample in pymc3. I’m afraid I’m missing something obvious to do either with using theano transformations or shape parameters, but can’t figure out which. Here is the simplest version of the model that replicates the problem.
N = 30
K = 3
# Make Data
z = TT._shared(np.random.normal(5,1,[N,K]))
xp = TT.dot(z,TT.transpose(z))
lam = xp_.eval()
x_train = np.random.exponential(lam)
#Model
with pm.Model() as simple_model:
z = pm.Normal('z',mu=0,sd=100,shape=(N,K))
x = pm.Exponential('x',lam=TT.dot(z,TT.transpose(z)),
observed=x_train)
I want to estimate the latent spaces z. No matter what, I always get a matrix of zeros. When I do the transformation with numpy instead of theano, (np.dot(z,np.transpose(z)) I get a dimension mismatch error instead. Thanks in advance for your help.
Note: it’s also possible that I’ve simplified my toy model too much, but the same issue happens when I use the model from this example. http://edwardlib.org/tutorials/latent-space-models
Edit: After more playing, it appears to be adding the dot product that breaks the model, not the shape or transpose. Same result using pm.math.dot.