can you share an example of icdf with negative binomial and poisson distros? #3230
Unanswered
jeycervantes
asked this question in
Q&A
Replies: 2 comments
-
To clarify, am using the latest version of torch/gluonts |
Beta Was this translation helpful? Give feedback.
0 replies
-
@jeycervantes you appear to be importing from the wrong path: use |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am looking into this library since it seems to support icdf for these distros but after installing and using in databricks it says these methods aren't implemented?
I see they should be implemented here however:
gluonts/src/gluonts/torch/distributions/negative_binomial.py
Line 57 in 3d05d46
Sorry if I just missed it, is there some demo snippet of code around this use-case? Thank you!
Here is some sample code below (that does not work)
from gluonts.mx import distribution
import mxnet as mx
Example parameters for Negative Binomial distribution
n = mx.nd.array([10])
p = mx.nd.array([0.5])
Create Negative Binomial distribution
neg_binom_dist = distribution.NegativeBinomial(mu=n, alpha=p)
Generate samples
samples = neg_binom_dist.sample(num_samples=10000).asnumpy()
Compute the inverse CDF (quantile function)
quantiles = neg_binom_dist.icdf(mx.nd.array([0.1, 0.5, 0.9])).asnumpy()
Display the quantiles
display(quantiles)
Best,
J
Beta Was this translation helpful? Give feedback.
All reactions