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

Adding the Hypergeometric Distribution (hypergeometricCdf + inverseHypergeometricCdf) (#15798) #15821

Closed
wants to merge 1 commit into from

Conversation

sriram201
Copy link

@sriram201 sriram201 commented Mar 12, 2021

Adding the Hypergeometric Distribution

Test plan - (Added unit tests)

== RELEASE NOTES ==

General Changes
* Add the hypergeometricCdf and inverseHypergeometricCdf functions.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Mar 12, 2021

CLA Signed

The committers are authorized under a signed CLA.

  • ✅ sriram201 (d1f72af950b41b401ad4054176deb0686799e46f)

@leepface
Copy link
Contributor

Code review:

  • squash down to one commit

Otherwise looks great!

Copy link
Contributor

@v-jizhang v-jizhang left a comment

Choose a reason for hiding this comment

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

LGTM

@talgalili
Copy link
Contributor

Hey @sriram201 ,
This diff looks good, but it seems to be missing the inverse_hypergeometric_cdf. Would you be able to please add it to this diff?

@sriram201
Copy link
Author

Hey @sriram201 ,
This diff looks good, but it seems to be missing the inverse_hypergeometric_cdf. Would you be able to please add it to this diff?

This seems to have been a pushing mixup. I fixed it

@talgalili
Copy link
Contributor

talgalili commented Apr 13, 2021 via email

@sriram201 sriram201 force-pushed the hypergeometric_dist branch 2 times, most recently from df36faf to da3c41d Compare April 13, 2021 22:02
@sriram201 sriram201 changed the title Adding the CDF for the Hypergeometric Distribution (#15798) Adding the Hypergeometric Distribution (hypergeometricCdf + inverseHypergeometricCdf) (#15798) Apr 26, 2021
@sriram201 sriram201 force-pushed the hypergeometric_dist branch from da3c41d to 997e4bd Compare April 26, 2021 19:11
.. function:: hypergeometric_cdf(populationSize, numberOfSuccesses, sampleSize, observedSuccesses) -> double

Compute the Hypergeometric cdf with given populationSize, numberOfSuccesses, sampleSize
and observed_successes: P(N <= observedSuccesses). The populationSize must be a positive integer
Copy link
Contributor

Choose a reason for hiding this comment

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

Please change observedSuccesses to value (just to be consistent with the other functions)

Copy link
Contributor

Choose a reason for hiding this comment

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

(please explain in the text here that value is observedSuccesses)

@@ -66,12 +66,25 @@ Mathematical Functions

Returns the value of ``string`` interpreted as a base-``radix`` number.

.. function:: hypergeometric_cdf(populationSize, numberOfSuccesses, sampleSize, observedSuccesses) -> double
Copy link
Contributor

Choose a reason for hiding this comment

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

Please change observedSuccesses to value (just to be consistent with the other functions)

(also in the function itself)

@SqlType(StandardTypes.INTEGER) long populationSize,
@SqlType(StandardTypes.INTEGER) long numberOfSuccesses,
@SqlType(StandardTypes.INTEGER) long sampleSize,
@SqlType(StandardTypes.INTEGER) long observedSuccesses)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please change observedSuccesses to value (just to be consistent with the other functions)


HypergeometricDistribution distribution = new HypergeometricDistribution((int) populationSize, (int) numberOfSuccesses, (int) sampleSize);

return distribution.cumulativeProbability((int) observedSuccesses);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please change observedSuccesses to value (just to be consistent with the other functions)

Copy link
Author

Choose a reason for hiding this comment

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

works for me

@talgalili
Copy link
Contributor

talgalili commented Apr 26, 2021 via email

@sriram201 sriram201 force-pushed the hypergeometric_dist branch from 997e4bd to 8cca542 Compare April 26, 2021 20:19
@sriram201 sriram201 force-pushed the hypergeometric_dist branch from 8cca542 to ea10fae Compare April 27, 2021 20:40
@talgalili
Copy link
Contributor

@rongrong the diffs seems updated and ready for review.

@talgalili
Copy link
Contributor

Hey @sriram201 - I see that this diff has merge conflicts, could you please resolve them?

@sriram201 sriram201 force-pushed the hypergeometric_dist branch from ea10fae to 678254b Compare May 10, 2021 22:49
@sriram201
Copy link
Author

Hey @sriram201 - I see that this diff has merge conflicts, could you please resolve them?

Done. Sorry about that

Adding the CDF and the inverse CDF for the Hypergeometric Distribution
@sriram201 sriram201 force-pushed the hypergeometric_dist branch from 678254b to 8c2fa52 Compare May 24, 2021 23:48
@rohanpednekar
Copy link
Contributor

Gentle ping! 🙏

@stale
Copy link

stale bot commented Apr 16, 2022

This pull request has been automatically marked as stale because it has not had recent activity. If you'd still like this PR merged, please comment on the task, make sure you've addressed reviewer comments, and rebase on the latest master. Thank you for your contributions!

@stale stale bot added the stale label Apr 16, 2022
@stale stale bot closed this Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants