I am trying to put an observe statement where the observation is a single 2-d value from a multivariate gaussian distribution.
When I try what I think should be correct, it doesn't give an error, but seems to get stuck forever on: Initialization warning [4/4]: Trace not initialized after 1000000 attempts.
//observing two pieces of evidence (mu1 and mu2) with certain reliabilities (var 1 and var2)
//the two pieces of evidence have possibly correlated noise
var inference_model = function(mu1,mu2,var1,var2, cor) {
return Infer({method: 'MCMC', samples: 10000}, function() {
var prior = Gaussian({mu: 50, sigma: 25})
var trueX = sample(prior)
var cov = cor*Math.sqrt(var1)*Math.sqrt(var2)
var evidence = MultivariateGaussian({mu: Vector([trueX,trueX]),
cov: Matrix([[var1,cov],
[cov,var2]])})
observe(evs, [mu1,mu2])
//observe(evs, {"0":mu1,"1":mu2})
return {'trueX':trueX}
})
}
var Posterior = inference_model(40, 60, 10,10, 0.1)
viz.marginals(Posterior)