Calculating marginal likelihood of GP Model

Hi,

Thanks for your comments on metrics.

Regarding the MLE:

lengthscale_true = 1
mean = pm.gp.mean.Zero()
cov = pm.gp.cov.ExpQuad(1,lengthscale_true)

n = 200
X_true = np.linspace(0,5,n)[:,None]
y_true = np.random.multivariate_normal(mean(X_true).eval(),cov(true).eval() + 1e-8*np.eye(n), 1).flatten()

noiseobs = 0.5
X_obs = X_true
y_obs = y_true + noiseobs * np.random.randn(n)

with pm.Model() as standardmodel:
noise_obs = pm.Flat(‘noise_obs’)
lengthscale = pm.Flat(‘lengthscale’)

covariance = pm.gp.cov.ExpQuad(1,lengthscale)
mean = pm.gp.mean.Zero()

gp_obs = pm.gp.Marginal(mean_func=mean, cov_func=covariance)

yobs = gp_obs.marginal_likelihood("yobs", X=X_obs, y=y_obs, noise=noise_obs)
start={'noise_obs': 0.5, 'lengthscale': 1}
mp = pm.find_MAP(start=start)

The error occurs on yobs line. The error is ValueError: array must not contain infs or NaNs. It can be reporoduced using the above code. I went through the trace but couldn’t find the problem. It might be happening due to Flat priors.