dask 2021.10.0

NotesParametersReturnsBackRef
weibull(self, a, size=None, chunks='auto', **kwargs)

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

Some inconsistencies with the Dask version may exist.

Draw samples from a 1-parameter Weibull distribution with the given shape parameter a.

$$X = (-ln(U))^{1/a}$$

Here, U is drawn from the uniform distribution over (0,1].

The more common 2-parameter Weibull, including a scale parameter $\lambda$ is just $X = \lambda(-ln(U))^{1/a}$ .

note

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

Notes

The Weibull (or Type III asymptotic extreme value distribution for smallest values, SEV Type III, or Rosin-Rammler distribution) is one of a class of Generalized Extreme Value (GEV) distributions used in modeling extreme value problems. This class includes the Gumbel and Frechet distributions.

The probability density for the Weibull distribution is

$$p(x) = \frac{a}{\lambda}(\frac{x}{\lambda})^{a-1}e^{-(x/\lambda)^a},$$

where $a$ is the shape and $\lambda$ the scale.

The function has its peak (the mode) at $\lambda(\frac{a-1}{a})^{1/a}$ .

When a = 1 , the Weibull distribution reduces to the exponential distribution.

Parameters

a : float or array_like of floats

Shape parameter of the distribution. Must be nonnegative.

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 a is a scalar. Otherwise, np.array(a).size samples are drawn.

Returns

out : ndarray or scalar

Drawn samples from the parameterized Weibull distribution.

Draw samples from a Weibull distribution.

See Also

Generator.weibull

which should be used for new code.

gumbel
scipy.stats.genextreme
scipy.stats.weibull_max
scipy.stats.weibull_min

Examples

Draw samples from the distribution:

This example is valid syntax, but we were not able to check execution
>>> a = 5. # shape  # doctest: +SKIP
... s = np.random.weibull(a, 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
... x = np.arange(1,100.)/50. # doctest: +SKIP
... def weib(x,n,a): # doctest: +SKIP
...  return (a / n) * (x / n)**(a - 1) * np.exp(-(x / n)**a)
This example is valid syntax, but we were not able to check execution
>>> count, bins, ignored = plt.hist(np.random.weibull(5.,1000))  # doctest: +SKIP
... x = np.arange(1,100.)/50. # doctest: +SKIP
... scale = count.max()/weib(x, 1., 5.).max() # doctest: +SKIP
... plt.plot(x, weib(x, 1., 5.)*scale) # doctest: +SKIP
... 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.gumbel

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