tensorflow / probability

Probabilistic reasoning and statistical analysis in TensorFlow
https://www.tensorflow.org/probability/
Apache License 2.0
4.16k stars 1.08k forks source link

CholeskyWishart distribution #527

Open srvasude opened 4 years ago

srvasude commented 4 years ago

These names are subject to change, but basically mimicking what PyMC3: https://docs.pymc.io/api/distributions/multivariate.html#pymc3.distributions.multivariate.LKJCholeskyCov

and Stan: https://mc-stan.org/docs/2_19/functions-reference/cholesky-lkj-correlation-distribution.html

In practice you would want samples from a CholeskyLKJ because the computations are more numerically stable (as well as log_prob and other calculations). We have LKJ(input_output_cholesky=True) which takes the cholesky of all outputs, and assumes the inputs are the cholesky of something. This works great for sampling, but the log_prob does not contain a Jacobian correction term (which can lead to different / potentially unwanted behavior), as it simply takes LL^T of the input.

skeydan commented 4 years ago

Hi, I'll be happy to test this with the data from https://blogs.rstudio.com/tensorflow/posts/2019-05-24-varying-slopes/ (where I used LKJ(input_output_cholesky=True) with the CorrelationCholesky bijector) as soon as it's available on any branch :-)

srvasude commented 4 years ago

I recently added a CholeskyLKJ, which you can try at head.

skeydan commented 4 years ago

Thanks! I just updated the blog post to use it :-)