dask 2021.10.0

ParametersReturns
geometric(self, p, size=None, chunks='auto', **kwargs)

This docstring was copied from numpy.random.mtrand.RandomState.geometric.

Some inconsistencies with the Dask version may exist.

Bernoulli trials are experiments with one of two outcomes: success or failure (an example of such an experiment is flipping a coin). The geometric distribution models the number of trials that must be run in order to achieve success. It is therefore supported on the positive integers, k = 1, 2, ... .

The probability mass function of the geometric distribution is

$$f(k) = (1 - p)^{k - 1} p$$

where p is the probability of success of an individual trial.

note

New code should use the geometric method of a default_rng() instance instead; please see the :None:ref:`random-quick-start`.

Parameters

p : float or array_like of floats

The probability of success of an individual trial.

size : int or tuple of ints, optional

Output shape. If the given shape is, e.g., (m, n, k) , then m * n * k samples are drawn. If size is None (default), a single value is returned if p is a scalar. Otherwise, np.array(p).size samples are drawn.

Returns

out : ndarray or scalar

Drawn samples from the parameterized geometric distribution.

Draw samples from the geometric distribution.

See Also

Generator.geometric

which should be used for new code.

Examples

Draw ten thousand values from the geometric distribution, with the probability of an individual success equal to 0.35:

This example is valid syntax, but we were not able to check execution
>>> z = np.random.geometric(p=0.35, size=10000)  # doctest: +SKIP

How many trials succeeded after a single run?

This example is valid syntax, but we were not able to check execution
>>> (z == 1).sum() / 10000.  # doctest: +SKIP
0.34889999999999999 #random
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /dask/array/random.py#293
type: <class 'function'>
Commit: