dpnp.random.negative_binomial
- dpnp.random.negative_binomial(n, p, size=None)[source]
Draw samples from a negative binomial distribution.
For full documentation refer to
numpy.random.negative_binomial
.Limitations
Parameters n and p are supported as scalar. Otherwise,
numpy.random.negative_binomial(n, p, size)
samples are drawn. Output array data type isdpnp.int32
.Examples
Draw samples from the distribution: A real world example. A company drills wild-cat oil exploration wells, each with an estimated probability of success of 0.1. What is the probability of having one success for each successive well, that is what is the probability of a single success after drilling 5 wells, after 6 wells, etc.?
>>> s = dpnp.random.negative_binomial(1, 0.1, 100000) >>> for i in range(1, 11): ... probability = sum(s<i) / 100000. ... print(i, "wells drilled, probability of one success =", probability)