cornellius-gp / gpytorch

A highly efficient implementation of Gaussian Processes in PyTorch
MIT License
3.57k stars 560 forks source link

[Feature Request] HalfNormal Prior #2145

Open feynmanliang opened 2 years ago

feynmanliang commented 2 years ago

🚀 Feature Request

We would like to use the half normal (ie truncated Normal) available in pytorch at dist.half_normal.HalfNormal as a prior distribution for fully Bayesian GP inference.

One caveat is that it seems like the recipe in torch_priors.py only works on pyro.distributions.HalfNormal...

Motivation

We use a HalfNormal prior in an existing production model and would like to replicate numerics with gpytorch.

Pitch

Describe the solution you'd like

self.register_prior('half_normal_param_prior', HalfNormalPrior(float_value_for_halfnormal_scale), 'half_normal_param')

Are you willing to open a pull request? (We LOVE contributions!!!)

Yes. Actually, @ZitongZhou and I already have some internal workaronds.

gpleiss commented 2 years ago

Sounds good! We'd happily accept a PR for this. What are the workarounds that are required?

ZitongZhou commented 2 years ago

Hi Geoff, I worked with Feynman and opened a PR for this issue to add HalfNormal prior. #2147