dask 2021.10.0

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

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

Some inconsistencies with the Dask version may exist.

Also known as the Lorentz distribution.

note

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

Notes

The probability density function for the full Cauchy distribution is

$$P(x; x_0, \gamma) = \frac{1}{\pi \gamma \bigl[ 1+(\frac{x-x_0}{\gamma})^2 \bigr] }$$

and the Standard Cauchy distribution just sets $x_0=0$ and $\gamma=1$

The Cauchy distribution arises in the solution to the driven harmonic oscillator problem, and also describes spectral line broadening. It also describes the distribution of values at which a line tilted at a random angle will cut the x axis.

When studying hypothesis tests that assume normality, seeing how the tests perform on data from a Cauchy distribution is a good indicator of their sensitivity to a heavy-tailed distribution, since the Cauchy looks very much like a Gaussian distribution, but with heavier tails.

Parameters

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. Default is None, in which case a single value is returned.

Returns

samples : ndarray or scalar

The drawn samples.

Draw samples from a standard Cauchy distribution with mode = 0.

See Also

Generator.standard_cauchy

which should be used for new code.

Examples

Draw samples and plot the distribution:

This example is valid syntax, but we were not able to check execution
>>> import matplotlib.pyplot as plt  # doctest: +SKIP
... s = np.random.standard_cauchy(1000000) # doctest: +SKIP
... s = s[(s>-25) & (s<25)] # truncate distribution so it plots well # doctest: +SKIP
... plt.hist(s, bins=100) # doctest: +SKIP
... 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#399
type: <class 'function'>
Commit: