dask 2021.10.0

NotesParametersReturns
logseries(self, p, size=None, chunks='auto', **kwargs)

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

Some inconsistencies with the Dask version may exist.

Samples are drawn from a log series distribution with specified shape parameter, 0 < p < 1.

note

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

Notes

The probability density for the Log Series distribution is

$$P(k) = \frac{-p^k}{k \ln(1-p)},$$

where p = probability.

The log series distribution is frequently used to represent species richness and occurrence, first proposed by Fisher, Corbet, and Williams in 1943 [2]. It may also be used to model the numbers of occupants seen in cars [3].

Parameters

p : float or array_like of floats

Shape parameter for the distribution. Must be in the range (0, 1).

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 logarithmic series distribution.

Draw samples from a logarithmic series distribution.

See Also

Generator.logseries

which should be used for new code.

scipy.stats.logser

probability density function, distribution or cumulative density function, etc.

Examples

Draw samples from the distribution:

This example is valid syntax, but we were not able to check execution
>>> a = .6  # doctest: +SKIP
... s = np.random.logseries(a, 10000) # doctest: +SKIP
... import matplotlib.pyplot as plt # doctest: +SKIP
... count, bins, ignored = plt.hist(s) # doctest: +SKIP

# plot against distribution

This example is valid syntax, but we were not able to check execution
>>> def logseries(k, p):  # doctest: +SKIP
...  return -p**k/(k*np.log(1-p))
... plt.plot(bins, logseries(bins, a)*count.max()/ # doctest: +SKIP
...  logseries(bins, a).max(), 'r')
... plt.show() # doctest: +SKIP
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#319
type: <class 'function'>
Commit: