probability icon indicating copy to clipboard operation
probability copied to clipboard

Semi-definite Covariance Matrix For distributions

Open Qiustander opened this issue 2 years ago • 1 comments

Hi all, recently I am dealing with state space model. For the transition equation x_t = Ax_{t-1} + W w_t, the w_t~N(0, I) is a multivariate normal distribution and W is a (possibly drop-rank) noise matrix. So I want to use MultivariateNormalLinearOperator to generate the a distribution object. For example, the state dimension is 6, W is 6x3 matrix, therefore, MultivariateNormalLinearOperator(loc=tf.zeros([6,]), scale=W) would raise Error when using .sample() because of incorrect dimension.

So I change to use MultivariateNormalFullCovariance with covariance matrix W @ tf.transpose(W). However, the covariance matrix not a full rank matrix, thus positive semi-definite. The nan samples happen when using .sample(). Is there any good method to solve this problem?

Qiustander avatar Jun 10 '23 02:06 Qiustander

You could use MVNDiagPlusLowRankCovariance: https://www.tensorflow.org/probability/api_docs/python/tfp/distributions/MultivariateNormalDiagPlusLowRankCovariance with very small values for the diagonal.

Brian Patton | Software Engineer | @.***

On Fri, Jun 9, 2023 at 10:19 PM Qiuliang Ye @.***> wrote:

Hi all, recently I am dealing with state space model. For the transition equation x_t = Ax_{t-1} + W w_t, the w_t~N(0, I) is a multivariate normal distribution and W is a (possibly drop-rank) noise matrix. So I want to use MultivariateNormalLinearOperator to generate the a distribution object. For example, the state dimension is 6, W is 6x3 matrix, therefore, MultivariateNormalLinearOperator(loc=tf.zeros([6,]), scale=W) would raise Error when using .sample() because of incorrect dimension.

So I change to use MultivariateNormalFullCovariance with covariance matrix W @ tf.transpose(W). However, the covariance matrix not a full rank matrix, thus positive semi-definite. The nan samples happen when using .sample(). Is there any good method to solve this problem?

— Reply to this email directly, view it on GitHub https://github.com/tensorflow/probability/issues/1728, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFJFSI6YN3MWNLGYDQFSGF3XKPKTXANCNFSM6AAAAAAZBK77AU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

brianwa84 avatar Jun 12 '23 14:06 brianwa84