Trying to sample from the LKJCovariancePrior
See original GitHub issueTrying to declare and LKJ prior and sample from it however it doesn’t like the event_shape of the sd_prior:
import torch
from gpytorch.priors import LKJCovariancePrior, GammaPrior
sd_prior = GammaPrior(torch.tensor([1.0]),torch.tensor([1.0]), validate_args=True)
cov_prior = LKJCovariancePrior(n=10, eta=1, sd_prior=sd_prior)
Traceback (most recent call last):
File "<ipython-input-40-1ca20a6657f1>", line 5, in <module>
cov_prior = LKJCovariancePrior(n=10, eta=1, sd_prior=sd_prior)
File "/home/vr308/anaconda3/lib/python3.8/site-packages/gpytorch/priors/lkj_prior.py", line 111, in __init__
raise ValueError("sd_prior must have event_shape 1 or n")
ValueError: sd_prior must have event_shape 1 or n
event_shape is not a settable attribute and by default it is empty torch.Size([]) for a prior over scalar - is this a bug?
Thanks.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to use LKJ prior? - greta forum
I am trying to include an LKJ prior in a network model with random sender and receiver effects. However, naively applying the decomposition...
Read more >LKJ Cholesky Covariance Priors for Multivariate Normal Models
To illustrate modelling covariance with the LKJ distribution, we first generate a two-dimensional normally-distributed sample data set. [1]:.
Read more >Hierarchical model hyperparameter for sampling the ...
Hi all I am trying to set up a hierarchical model. My model needs to sample the site-specific mean and covariance between two...
Read more >Hierarchical model hyperparameter ... - Pyro Discussion Forum
I am trying to set up a hierarchical model. My model needs to sample the site-specific mean and covariance between two variables at...
Read more >Hierarchical modeling with the LKJ prior in PyMC
I describe how to use the LKJCholeskyCov and LKJCorr distributions to include correlated priors in Bayesian hierarchical modeling using PyMC.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can try to setup a PR soon, finally managed to track down some code for sampling from the LKJ priors:
Hi, I was dealing with this the other day, and don’t think it’s actually a bug in gpytorch but rather a bug in
torch.distributions.ExponentialFamily
(or some strange feature), as there’s no way to set event shape in those distributions.This works though because you can set
_event_shape
: