Skip to content

ENH: added random.hypergeometric #277

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

Merged
merged 4 commits into from
Nov 21, 2020

Conversation

samir-nasibli
Copy link

@samir-nasibli samir-nasibli commented Nov 19, 2020

Description

hypergeometric(ngood, nbad, nsample[, size]) Draw samples from a Hypergeometric distribution.

TODO

Reproduce

>>> np.mean(dpnp.random.hypergeometric(ngood, nbad, nsamp, 10**5));np.mean(np.random.hypergeometric(ngood, nbad, nsamp, 10**5))
9.80247
9.8022
>>> np.var(dpnp.random.hypergeometric(ngood, nbad, nsamp, 10**5));np.var(np.random.hypergeometric(ngood, nbad, nsamp, 10**5))
0.17519976710000346
0.17278891189999998

Checklist

  • Docstrings for all functions
  • Gallery example in ./doc/examples (new features only)
  • Unit tests:
  • Clean style in the spirit of PEP8

@samir-nasibli samir-nasibli added the in progress Please do not merge. Work is in progress. label Nov 19, 2020
@samir-nasibli samir-nasibli removed the in progress Please do not merge. Work is in progress. label Nov 19, 2020
Comment on lines +636 to +647
# TODO:
# array_like of ints for `ngood`, `nbad`, `nsample` param
if ngood < 0:
checker_throw_value_error("hypergeometric", "ngood", ngood, "non-negative")
if nbad < 0:
checker_throw_value_error("hypergeometric", "nbad", nbad, "non-negative")
if nsample < 0:
checker_throw_value_error("hypergeometric", "nsample", nsample, "non-negative")
if ngood + nbad < nsample:
checker_throw_value_error("hypergeometric", "nsample", nsample, "ngood + nbad >= nsample")
if nsample < 1:
checker_throw_value_error("hypergeometric", "nsample", nsample, ">= 1")
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add block Limitations to the docstring?

Copy link
Contributor

@shssf shssf left a comment

Choose a reason for hiding this comment

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

docstrings

@shssf shssf merged commit 85f6fd6 into master Nov 21, 2020
@shssf shssf deleted the samir-nasibli/feature/random_hypergeometric branch November 21, 2020 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants