dask 2021.10.0

NotesParametersReturnsBackRef
gumbel(self, loc=0.0, scale=1.0, size=None, chunks='auto', **kwargs)

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

Some inconsistencies with the Dask version may exist.

Draw samples from a Gumbel distribution with specified location and scale. For more information on the Gumbel distribution, see Notes and References below.

note

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

Notes

The Gumbel (or Smallest Extreme Value (SEV) or the Smallest Extreme Value Type I) distribution is one of a class of Generalized Extreme Value (GEV) distributions used in modeling extreme value problems. The Gumbel is a special case of the Extreme Value Type I distribution for maximums from distributions with "exponential-like" tails.

The probability density for the Gumbel distribution is

$$p(x) = \frac{e^{-(x - \mu)/ \beta}}{\beta} e^{ -e^{-(x - \mu)/\beta}},$$

where $\mu$ is the mode, a location parameter, and $\beta$ is the scale parameter.

The Gumbel (named for German mathematician Emil Julius Gumbel) was used very early in the hydrology literature, for modeling the occurrence of flood events. It is also used for modeling maximum wind speed and rainfall rates. It is a "fat-tailed" distribution - the probability of an event in the tail of the distribution is larger than if one used a Gaussian, hence the surprisingly frequent occurrence of 100-year floods. Floods were initially modeled as a Gaussian process, which underestimated the frequency of extreme events.

It is one of a class of extreme value distributions, the Generalized Extreme Value (GEV) distributions, which also includes the Weibull and Frechet.

The function has a mean of $\mu + 0.57721\beta$ and a variance of $\frac{\pi^2}{6}\beta^2$ .

Parameters

loc : float or array_like of floats, optional

The location of the mode of the distribution. Default is 0.

scale : float or array_like of floats, optional

The scale parameter of the distribution. Default is 1. Must be non- negative.

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 loc and scale are both scalars. Otherwise, np.broadcast(loc, scale).size samples are drawn.

Returns

out : ndarray or scalar

Drawn samples from the parameterized Gumbel distribution.

Draw samples from a Gumbel distribution.

See Also

Generator.gumbel

which should be used for new code.

scipy.stats.genextreme
scipy.stats.gumbel_l
scipy.stats.gumbel_r
weibull

Examples

Draw samples from the distribution:

This example is valid syntax, but we were not able to check execution
>>> mu, beta = 0, 0.1 # location and scale  # doctest: +SKIP
... s = np.random.gumbel(mu, beta, 1000) # doctest: +SKIP

Display the histogram of the samples, along with the probability density function:

This example is valid syntax, but we were not able to check execution
>>> import matplotlib.pyplot as plt  # doctest: +SKIP
... count, bins, ignored = plt.hist(s, 30, density=True) # doctest: +SKIP
... plt.plot(bins, (1/beta)*np.exp(-(bins - mu)/beta) # doctest: +SKIP
...  * np.exp( -np.exp( -(bins - mu) /beta) ),
...  linewidth=2, color='r')
... plt.show() # doctest: +SKIP

Show how an extreme value distribution can arise from a Gaussian process and compare to a Gaussian:

This example is valid syntax, but we were not able to check execution
>>> means = []  # doctest: +SKIP
... maxima = [] # doctest: +SKIP
... for i in range(0,1000) : # doctest: +SKIP
...  a = np.random.normal(mu, beta, 1000)
...  means.append(a.mean())
...  maxima.append(a.max())
... count, bins, ignored = plt.hist(maxima, 30, density=True) # doctest: +SKIP
... beta = np.std(maxima) * np.sqrt(6) / np.pi # doctest: +SKIP
... mu = np.mean(maxima) - 0.57721*beta # doctest: +SKIP
... plt.plot(bins, (1/beta)*np.exp(-(bins - mu)/beta) # doctest: +SKIP
...  * np.exp(-np.exp(-(bins - mu)/beta)),
...  linewidth=2, color='r')
... plt.plot(bins, 1/(beta * np.sqrt(2 * np.pi)) # doctest: +SKIP
...  * np.exp(-(bins - mu)**2 / (2 * beta**2)),
...  linewidth=2, color='g')
... plt.show() # doctest: +SKIP
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

dask.array.random.RandomState.weibull

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#297
type: <class 'function'>
Commit: