google-deepmind / torch-distributions

Probability distributions, wrapped for Torch.
BSD 3-Clause "New" or "Revised" License
61 stars 25 forks source link

Fix bug for Gaussian with near singular covariance matrices #38

Closed jucor closed 9 years ago

jucor commented 9 years ago

Until now, with some (but not all) very-near singular covariance matrices such as occurring in Gaussian Processes, the multivariate Gaussian RNG was completely utterly wrong. This was due to me forgetting a transpose of the result of the SVD when I added support for very-near singular matrices in da73e86525f9ff5f02ecad9ecfc1e930b0a8e409.

For my (weak) defence, Torch and Numpy have different conventions as to the transpose of the V matrix resulting from the SVD, and I got bitten.

This pull-request adds the missing transpose, and a test on a typical gaussian process example to detect any regression.