theogf / AugmentedGaussianProcesses.jl

Gaussian Process package based on data augmentation, sparsity and natural gradients
https://theogf.github.io/AugmentedGaussianProcesses.jl/dev/
Other
135 stars 9 forks source link

Alternative negative binomial parameterization? #64

Closed sdwfrost closed 3 years ago

sdwfrost commented 3 years ago

Hi @theogf! I'd like to fit some overdispersed count data, for which I'd like to use a negative binomial distribution, and infer the overdispersion parameter (ideally also putting a GP on that as well but that's another issue). I saw that in your implementation of the negative binomial, you have r as an Int rather than allowing it to be a Float. Is there any reason to restrict r in this way?

theogf commented 3 years ago

Hi @sdwfrost, having r as an Int definitely helps for computing the normalization constant, but other than that there is no constraint. Having another GP as a source for r would be extremely complex I think... Since r appears in the binomial coefficient my wild guess would be that gradients would be quite unstable. Nonetheless I can make a PR to change that, I am in the AISTATS deadline rush right now but I will take care of it afterwards (with a partial refactoring of the package actually :P )

theogf commented 3 years ago

Hi @sdwfrost, so I had a look if r could be unrestricted to Integers and the problem would come from this line : https://github.com/theogf/AugmentedGaussianProcesses.jl/blob/089025c850fb4e0c3ff29cbf0a5ede339d4894e0/src/likelihood/negativebinomial.jl#L131

The binomial can only take integers, if you have a an alternative solution, I would be happy to add it!

sdwfrost commented 3 years ago

You can use Gamma functions instead of binomial coefficients, as described here. Ideally, I'd like a parameterization along the same lines as the alternative parameterization in Stan.

theogf commented 3 years ago

Ok so I created #68, I did not copy the Stan parametrization as it would become too heavy, but it is now possible to use Real numbers for r. I also added a small example for it in docs/examples