Added Gompertz distribution class, sampling utilities
Added the ability to sample from the Gompertz distribution by implementing a Gompertz class under numpyro.dist.continuous
https://www.tandfonline.com/doi/abs/10.1080/03461238.2012.687697
There are approximations for the expectation and variance in
Lenart A. The moments of the Gompertz distribution and maximum likelihood estimation of its parameters. Scand Actuar J. 2014;2014: 255–277. doi:10.1080/03461238.2012.687697
that may be useful.
will add tests / docs shortly
hi, I fixed the usage of log1p and expm1. I also undid my accidental edit to Laplace. I swapped the order of rate and concentration now to reflect the gamma distribution args, and set rate = 1.0 by default.
How can I get started with adding tests and docs?
hi, I fixed the usage of
log1pandexpm1. I also undid my accidental edit toLaplace. I swapped the order ofrateandconcentrationnow to reflect the gamma distribution args, and setrate = 1.0by default.How can I get started with adding tests and docs?
I'm confused by the T(<Class>, <Vals> idiom and don't write to write a trivial test suite
Hi @jackpot-nfer, for testing, you will need to add Gompertz to init (and also docs), and add a couple of entries to here:
T(dist.Gompertz, jnp.array([1.7]), jnp.array([[2.0], [3.0]])),
T(dist.Gompertz, jnp.array([0.5, 1.3]), jnp.array([[1.0], [3.0]])),
@fehiepsi I believe all the necessary tests and docs edits have been made.
@jackpot-nfer There are also a couple of lint issues. You can run make lint locally to see them. I guess you need two \\ like this example.
Hey @fehiepsi, I've reparametrized the distribution as requested. It now takes concentration and rate=1.0 as args. I also added a scale argument and attribute. If it's provided (None by default), it sets rate = 1 / scale. If not, the scale parameter is set to 1 / rate as you'd expect. I figured this was a good compromise between sticking to the wikipedia derivation (which uses a scale parameter) and also matching the Gamma distribution (by having rate=1.0 as a default). rate attribute is used in all calculations, but scale attribute is accessible in any case.
I'm having trouble to get the tests to run right now -- tried running from a fresh venv and still didn't work. Not sure what is causing that. Could you try running them?
I manually blackened and isorted the change files, so all should be good to go on that front.
@jackpot-nfer It has been a while but I guess we're only blocked by missing some tests. Can I add a commit for it in this PR?
@fehiepsi I don't want to speak for @jackpotrykus , but I'm quite certain this would be fine.
We just merged #1551. Thanks @jackpot-nfer and @cameronraysmith !!