# Dimensions of log likelihood for Gaussian process

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?

• 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. Commented Mar 31, 2021 at 13:01

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.