MVNPrecisionCholeskyWithUncerts (Part II)

19 views
Skip to first unread message

Angel Berihuete

unread,
Apr 30, 2021, 4:23:11 AM4/30/21
to TensorFlow Probability
Dear TFP users.

I've changed my previous code at


with a new version at


I've included all the comments suggested by Dave in the previous discussion, and some recursive functions in order to do the code not dimension dependent.

In the first version I forgot to include a tf.linalg.cholesky function. You can see this "small detail" in the sanity check scatter-plot. The first version has a slight rotation in the data.

Now, when I include the

C3_chol =tf.linalg.cholesky(tf.stack(C3))

in line 61, inside the class MVNPrecisionCholeskyWithUncerts, I get an error

InvalidArgumentError: Cholesky decomposition was not successful. The input might not be valid.

Looking inside de matrices obtained in C3 there are some discrepancies on values outside the main diagonal, i.e., matrix is not "completely" symmetric ... maybe due to floating point errors?

Again is weird ... I can sample from the distribution, but I cannot use it to do inference!

Any clue to resolve this?

Dave Moore

unread,
May 3, 2021, 4:59:58 PM5/3/21
to Angel Berihuete, TensorFlow Probability
The usual hacks to coax a matrix A to be numerically positive definite are:

1) Symmetrization: `A = 0.5 * (A + tf.linalg.matrix_transpose(A))`.
2) Diagonal padding: `A = tf.linalg.set_diag(A, tf.linalg.diag_part(A) + eps) `where eps is some small positive number.

You might also look at our recently-added `simple_robustified_cholesky` method:

Dave

--
You received this message because you are subscribed to the Google Groups "TensorFlow Probability" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfprobabilit...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfprobability/832cd629-371e-40b6-89eb-17e223d79cc6n%40tensorflow.org.

Angel Berihuete

unread,
May 16, 2021, 1:18:16 PM5/16/21
to TensorFlow Probability, dav...@google.com, TensorFlow Probability, Angel Berihuete
Dear Dave, so sorry for this huge delay in my response ...too many projects to develop ;)

simple_robustified_cholesky worked perfectly!!

Again, many thanks!!
Ángel
Reply all
Reply to author
Forward
0 new messages