The log-likelihood for a Gaussian process is given by

$$\log p(y|X) = -\frac{1}{2}y^T(K+\sigma^2_n I)^{-1}y - \frac{1}{2}\log|K+\sigma^2_n I|-\frac{n}{2}\log2\pi$$

[See here: https://stats.stackexchange.com/questions/280105/log-marginal-likelihood-for-gaussian-process]

I don't understand how one would compute this, as to my eyes the dimensions don't match up. The first term $-\frac{1}{2}y^T(K+\sigma^2_n I)^{-1}y$ yields just a number, but the second term $\frac{1}{2}\log|K+\sigma^2_n I|$ is a matrix. Am I going wrong in my thinking here?

  • $\begingroup$ The expression you wrote is not log-likelihood, it is log-marginal-likelihood. They both are very very different. The likelihood of a Gaussian process is $p(y|f) = \mathcal{N}(f, \sigma_n^2)$. reference slide 4. $\endgroup$ Commented Mar 31, 2021 at 13:01

1 Answer 1


The second term is the determinant of the covariance matrix $$ |K + \sigma^2_nI| = \det(K + \sigma^2_nI), $$ which is a polynomial function that outputs a scalar value.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.