Skip to content

Deterministic (up to numerical error) multivariate_normal sampling #13386

Closed

Description

@horta

Currently, numpy.random.multivariate_normal makes use of SVD decomposition, numpy.dual.svd, on the provided covariance matrix to perform the sampling. This approach allows the use of positive semi-definite covariance matrix. However, it is not unique as the singular vectors are not guaranteed to be. In fact,

[[-1, 0],
 [0,  -1]]

and

[[1, 0],
 [0,  1]]

can be the singular-vectors of a 2-by-2 identity matrix.

A Cholesky decomposition instead would result in an unique decomposition with the down side of only working on positive definite matrices. We could use instead a Cholesky decomposition with complete pivoting: http://www.netlib.org/lapack/explore-html/da/dba/group__double_o_t_h_e_rcomputational_ga31cdc13a7f4ad687f4aefebff870e1cc.html
It provides both advantages: works on positive semi-definite matrices and are unique (as far as I know).

Any thoughts?

Related issue: #13358

Activity

  1. rkern commented on Apr 22, 2019

    @rkern
    Member

    See #3938 for previous discussion of this suggestion. There are several other discussions that you can find by searching for multivariate_normal cholesky.

  2. rkern commented on Apr 22, 2019

    @rkern
    Member

    Though I see that the only remaining issue is stream compatibility, which will be manageable after the NEP 19 implementation PR gets in.

  3. mattip commented on May 30, 2019

    @mattip
    Member

    @rkern can we close this as a duplicate?

  4. mattip commented on Jun 6, 2019

    @mattip
    Member

    Closing, please reopen if I misunderstood.

  5. horta commented on Sep 13, 2019

    @horta
    Author

    It is not duplication because this thread tackles the problem of multiple decompositions (SVD) versus unique decomposition (pivoted Cholesky) to semi-definite positive matrices.

    Rounding error is not within the scope of this discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions