tpapp / TransformVariables.jl

Transformations to contrained variables from ℝⁿ.
Other
66 stars 14 forks source link

symmetric positive definite domain #6

Open simonbyrne opened 6 years ago

simonbyrne commented 6 years ago

Could you add a symmetric positive definite domain transformation? It could be based on the correlation one.

tpapp commented 6 years ago

I will add one (perhaps in the examples on how to use CustomTransform). But I am curious what you need it for, since in practice its Cholesky factor is much more useful for inference.

simonbyrne commented 6 years ago

I have a model where the prior is inverse Wishart.

tpapp commented 6 years ago

I added it as a test/example.

I will think about adding it as a regular transform, but I don't think Wishart is a good prior, so I would rather encourage using half-Cauchy for standard deviations and LKJ for the correlation matrix (apologies if you know about this and decided you still need Wishart).

simonbyrne commented 6 years ago

I agree, but i'm replicating someone else's results.

simonbyrne commented 6 years ago

and thanks for the example!

tpapp commented 6 years ago

@simonbyrne: just to let you know, I am merging an API change now. I have updated the example in the tests.

If you are using this library in production, you may want to pin to df4234b, or update your code.

As the library is currently in development and I am experimenting, there will be no deprecations or releases until it stabilizes. So you may want to use Github's watch functionality for notifications.

simonbyrne commented 6 years ago

No problem, thanks for the heads up.

aterenin commented 5 years ago

+1 to please add this. I don't think preference against the Inverse Wishart prior is a strong reason not to include this transform - appropriateness of the Wishart/IW prior depends on the user's likelihood. I'm using a Wishart it for estimating a symmetric positive definite matrix that isn't a covariance (i.e. my likelihood is not multivariate Gaussian with unknown Sigma or anything remotely near), where LKJ is not necessarily appropriate, and Wishart with identity hyperparameter is a natural choice due to its group invariance properties.

tpapp commented 5 years ago

So would you need a transformation from an n⋅(n+1)/2 vector of reals to an n × n positive definite matrix?

aterenin commented 5 years ago

Yes - just as in Stan - this would be fantastic!