Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ICDF and CDF to BernoulliProbs #1652

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

12kleingordon34
Copy link

I was using numpyro for a particular application which required an ICDF and CDF for a Bernoulli, however this was not yet implemented.

I use Heaviside functions to calculate the CDF and ICDF. Tests are a little more complicated, as for a Bernoulli one doesn't recover the original quantiles when passing uniform samples through an ICDF, and then back through a CDF. I added a few specific lines for the Bernoulli such that the mean of ICDF(quantiles) is roughly equal to the probability parameter for the bernoulli. To test the CDF, I check that the proportion of ones yielded through CDF(ICDF(quantiles)) is roughly equal to p, and that the proportion of (1 - p) values through the same function is roughly equal to (1 - p).

Copy link
Member

@fehiepsi fehiepsi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for your first contribution, @12kleingordon34! Could you also add the same methods to BernoulliLogits? The implementation would be the same.

@fehiepsi
Copy link
Member

Hi @12kleingordon34, we will make a new release in the next few days. Do you want to incorporate this PR in the release?

@12kleingordon34
Copy link
Author

Hi @fehiepsi , apologies for leaving this for so long. I'll add the bernoulli logits by the end of next week with the corresponding test, but if it's too late i'll leave it for the next one.

@fehiepsi
Copy link
Member

Thanks, @12kleingordon34! Please take your time. We are in no hurry to make a release.

@fehiepsi
Copy link
Member

fehiepsi commented Sep 5, 2024

Friendly ping :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants