Very simple model with DensityDist

I figured it out. I was supplying only a single datapoint to the dot product instead of the whole vector like I thought. Below is an example that seems to be working better in case anybody runs into the same thing.

data_prior = np.random.dirichlet(0.1*np.ones(10))

data_sample = np.random.dirichlet(data_prior,size=100)
print(data_sample.shape)

data=data_sample
with pm.Model() as model:
    
    theta = pm.Dirichlet('theta', a=np.ones(data.shape[1]), shape=(data.shape[1]), testval=None)
    
    data_est = pm.DensityDist('data_est',lambda value: tt.log(tt.dot(theta,value.T)), observed=data)
    
    map_estimate = pm.find_MAP()
    trace = pm.sample(5000, tune=500, chains=1, njobs=1, progressbar=True, nuts_kwargs={'target_accept':0.85})
2 Likes