#Example for Pymc3 forums
import pymc3 as pm
import theano.tensor as tt
import pandas as pd
import numpy as np
pred_arr = [[2,3,4],[5,1,9]]
data = [2,3]
with pm.Model() as model:
a_vec = np.array([100 for i in range(3)])
prior = pm.Dirichlet('a',a = a_vec,shape=(3))
likelihood = pm.Normal('y',mu = tt.dot(np.array(pred_arr),prior),sd = 0.1,observed = np.array(data).T)
abra = pm.find_MAP()
trace = pm.fit(1000,start = abra)
In the above example of dirichlet regression (note the numbers are just nonsense), I don’t understand why the posterior values of the concentration parameters of the dirichlet sum to 1. Why is this?
EDIT: I am very sorry, my brain had a massive derp. obviously the MAP values are not the MAPs of the concentration parameters, rather the actual values for which the posterior is maxed. Please close this.