I've tried to fit a simple 2D gaussian model to observed data by using PyMC3.
import numpy as np
import pymc3 as pm
n = 10000;
np.random.seed(0)
X = np.random.multivariate_normal([0,0], [[1,0],[0,1]], n);
with pm.Model() as model:
# PRIORS
mu = [pm.Uniform('mux', lower=-1, upper=1),
pm.Uniform('muy', lower=-1, upper=1)]
cov = np.array([[pm.Uniform('a11', lower=0.1, upper=2), 0],
[0, pm.Uniform('a22', lower=0.1, upper=2)]])
# LIKELIHOOD
likelihood = pm.MvNormal('likelihood', mu=mu, cov=cov, observed=X)
with model:
trace = pm.sample(draws=1000, chains=2, tune=1000)
while I can do this in 1D by passing the sd to pm.Normal, I have some trouble in passing the covariance matrix to pm.MvNormal.
Where am I going wrong?