# Problem with singular covariance matrices when doing gaussian process regression

I'm working with gaussian process regression. Currently I start testing differnt covariance functions and compositions to see what type of data they could describe best. I made an own implementation in Java.

My problem: Most of the covariance funtions I use result in a singular covariance matrix which is not invertable.

1. Should't the proposed covariance functions/estimators produce only invertable matrices?

2. Are there methods or hints for regularizing the matrices? Or can that be done by using other values or ranges as inputs? May the introduction of error terms would help as well? Most problems I get with integer $x$ inputs to the brownian motion covariance function $k(x,x') = \min(x,x')$. When I am using this the matrix it is always singular.

Thank you

-

## 1 Answer

If all covariance functions give you a singular matrix, it could be that some of your data points are identical, which gives two identical rows/columns in the matrix. To regularise the matrix, just add a ridge on the principal diagonal (as in ridge regression), which is used in Gaussian process regression as a noise term.

Note that using a composition of covariance functions or an additive combination can lead to over-fitting the marginal likelihood in evidence based model selection due to the increased number of hyper-parameters, and so can give worse results than a more basic covariance function, even though the basic covariance function is less suitable for modelling the data.

-
I read in some publications about estimating the inverse for singular matrices. Is that a standard problem in gaussian process regression or why is there so much literature about numerical problems in the covariance matrices. – Andreas Jan 13 '12 at 10:35

1
The matrix is often ill-conditioned, so there are indeed a few tricks for inverting it more reliably, there is a good discussion of this in Rasmussen and Williams book. However, I have found that I normally only run into problems when model selection tries to make a very bland RBF covariance to model an essentially linear decision boundary, so you could argue it was model mis-specification? I haven't used GP regression very much, so it is hard to know whether it crops up more often there. – Dikran Marsupial Jan 13 '12 at 15:24
"there is a good discussion of this in Rasmussen and Williams book" - May i ask where exactly – Andreas Jan 16 '12 at 9:56

1
The key trick to limiting numerical instability is on page 45 (equation 3.26). – Dikran Marsupial Jan 16 '12 at 11:04
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 2, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9151065349578857, "perplexity_flag": "middle"}