neulab/docprompting-conala huggingface dataset:
numpy.random.standard_cauchy   random.standard_cauchy(size=None)
 
Draw samples from a standard Cauchy distribution with mode = 0. Also known as the Lorentz distribution.  Note New code should use the standard_cauchy method of a default_rng() instance instead; please see the Quick Start.   Parameters 
 
sizeint 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 
 
samplesndarray or scalar


The drawn samples.      See also  Generator.standard_cauchy

which should be used for new code.    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. References  1 
NIST/SEMATECH e-Handbook of Statistical Methods, “Cauchy Distribution”, https://www.itl.nist.gov/div898/handbook/eda/section3/eda3663.htm  2 
Weisstein, Eric W. “Cauchy Distribution.” From MathWorld–A Wolfram Web Resource. http://mathworld.wolfram.com/CauchyDistribution.html  3 
Wikipedia, “Cauchy distribution” https://en.wikipedia.org/wiki/Cauchy_distribution   Examples Draw samples and plot the distribution: >>> import matplotlib.pyplot as plt
>>> s = np.random.standard_cauchy(1000000)
>>> s = s[(s>-25) & (s<25)]  # truncate distribution so it plots well
>>> plt.hist(s, bins=100)
>>> plt.show()
numpy.random.standard_exponential   random.standard_exponential(size=None)
 
Draw samples from the standard exponential distribution. standard_exponential is identical to the exponential distribution with a scale parameter of 1.  Note New code should use the standard_exponential method of a default_rng() instance instead; please see the Quick Start.   Parameters 
 
sizeint 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 
 
outfloat or ndarray


Drawn samples.      See also  Generator.standard_exponential

which should be used for new code.    Examples Output a 3x8000 array: >>> n = np.random.standard_exponential((3, 8000))
numpy.random.standard_gamma   random.standard_gamma(shape, size=None)
 
Draw samples from a standard Gamma distribution. Samples are drawn from a Gamma distribution with specified parameters, shape (sometimes designated “k”) and scale=1.  Note New code should use the standard_gamma method of a default_rng() instance instead; please see the Quick Start.   Parameters 
 
shapefloat or array_like of floats


Parameter, must be non-negative.  
sizeint 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 shape is a scalar. Otherwise, np.array(shape).size samples are drawn.    Returns 
 
outndarray or scalar


Drawn samples from the parameterized standard gamma distribution.      See also  scipy.stats.gamma

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

which should be used for new code.    Notes The probability density for the Gamma distribution is  \[p(x) = x^{k-1}\frac{e^{-x/\theta}}{\theta^k\Gamma(k)},\] where \(k\) is the shape and \(\theta\) the scale, and \(\Gamma\) is the Gamma function. The Gamma distribution is often used to model the times to failure of electronic components, and arises naturally in processes for which the waiting times between Poisson distributed events are relevant. References  1 
Weisstein, Eric W. “Gamma Distribution.” From MathWorld–A Wolfram Web Resource. http://mathworld.wolfram.com/GammaDistribution.html  2 
Wikipedia, “Gamma distribution”, https://en.wikipedia.org/wiki/Gamma_distribution   Examples Draw samples from the distribution: >>> shape, scale = 2., 1. # mean and width
>>> s = np.random.standard_gamma(shape, 1000000)
 Display the histogram of the samples, along with the probability density function: >>> import matplotlib.pyplot as plt
>>> import scipy.special as sps  
>>> count, bins, ignored = plt.hist(s, 50, density=True)
>>> y = bins**(shape-1) * ((np.exp(-bins/scale))/  
...                       (sps.gamma(shape) * scale**shape))
>>> plt.plot(bins, y, linewidth=2, color='r')  
>>> plt.show()
numpy.random.standard_normal   random.standard_normal(size=None)
 
Draw samples from a standard Normal distribution (mean=0, stdev=1).  Note New code should use the standard_normal method of a default_rng() instance instead; please see the Quick Start.   Parameters 
 
sizeint 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 
 
outfloat or ndarray


A floating-point array of shape size of drawn samples, or a single sample if size was not specified.      See also  normal

Equivalent function with additional loc and scale arguments for setting the mean and standard deviation.  Generator.standard_normal

which should be used for new code.    Notes For random samples from \(N(\mu, \sigma^2)\), use one of: mu + sigma * np.random.standard_normal(size=...)
np.random.normal(mu, sigma, size=...)
 Examples >>> np.random.standard_normal()
2.1923875335537315 #random
 >>> s = np.random.standard_normal(8000)
>>> s
array([ 0.6888893 ,  0.78096262, -0.89086505, ...,  0.49876311,  # random
       -0.38672696, -0.4685006 ])                                # random
>>> s.shape
(8000,)
>>> s = np.random.standard_normal(size=(3, 4, 2))
>>> s.shape
(3, 4, 2)
 Two-by-four array of samples from \(N(3, 6.25)\): >>> 3 + 2.5 * np.random.standard_normal(size=(2, 4))
array([[-4.49401501,  4.00950034, -1.81814867,  7.29718677],   # random
       [ 0.39924804,  4.68456316,  4.99394529,  4.84057254]])  # random
numpy.random.triangular   random.triangular(left, mode, right, size=None)
 
Draw samples from the triangular distribution over the interval [left, right]. The triangular distribution is a continuous probability distribution with lower limit left, peak at mode, and upper limit right. Unlike the other distributions, these parameters directly define the shape of the pdf.  Note New code should use the triangular method of a default_rng() instance instead; please see the Quick Start.   Parameters 
 
leftfloat or array_like of floats


Lower limit.  
modefloat or array_like of floats


The value where the peak of the distribution occurs. The value must fulfill the condition left <= mode <= right.  
rightfloat or array_like of floats


Upper limit, must be larger than left.  
sizeint 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 left, mode, and right are all scalars. Otherwise, np.broadcast(left, mode, right).size samples are drawn.    Returns 
 
outndarray or scalar


Drawn samples from the parameterized triangular distribution.      See also  Generator.triangular

which should be used for new code.    Notes The probability density function for the triangular distribution is  \[\begin{split}P(x;l, m, r) = \begin{cases} \frac{2(x-l)}{(r-l)(m-l)}& \text{for $l \leq x \leq m$},\\ \frac{2(r-x)}{(r-l)(r-m)}& \text{for $m \leq x \leq r$},\\ 0& \text{otherwise}. \end{cases}\end{split}\] The triangular distribution is often used in ill-defined problems where the underlying distribution is not known, but some knowledge of the limits and mode exists. Often it is used in simulations. References  1 
Wikipedia, “Triangular distribution” https://en.wikipedia.org/wiki/Triangular_distribution   Examples Draw values from the distribution and plot the histogram: >>> import matplotlib.pyplot as plt
>>> h = plt.hist(np.random.triangular(-3, 0, 8, 100000), bins=200,
...              density=True)
>>> plt.show()
numpy.random.uniform   random.uniform(low=0.0, high=1.0, size=None)
 
Draw samples from a uniform distribution. Samples are uniformly distributed over the half-open interval [low, high) (includes low, but excludes high). In other words, any value within the given interval is equally likely to be drawn by uniform.  Note New code should use the uniform method of a default_rng() instance instead; please see the Quick Start.   Parameters 
 
lowfloat or array_like of floats, optional


Lower boundary of the output interval. All values generated will be greater than or equal to low. The default value is 0.  
highfloat or array_like of floats


Upper boundary of the output interval. All values generated will be less than or equal to high. The high limit may be included in the returned array of floats due to floating-point rounding in the equation low + (high-low) * random_sample(). The default value is 1.0.  
sizeint 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 low and high are both scalars. Otherwise, np.broadcast(low, high).size samples are drawn.    Returns 
 
outndarray or scalar


Drawn samples from the parameterized uniform distribution.      See also  randint

Discrete uniform distribution, yielding integers.  random_integers

Discrete uniform distribution over the closed interval [low, high].  random_sample

Floats uniformly distributed over [0, 1).  random

Alias for random_sample.  rand

Convenience function that accepts dimensions as input, e.g., rand(2,2) would generate a 2-by-2 array of floats, uniformly distributed over [0, 1).  Generator.uniform

which should be used for new code.    Notes The probability density function of the uniform distribution is  \[p(x) = \frac{1}{b - a}\] anywhere within the interval [a, b), and zero elsewhere. When high == low, values of low will be returned. If high < low, the results are officially undefined and may eventually raise an error, i.e. do not rely on this function to behave when passed arguments satisfying that inequality condition. The high limit may be included in the returned array of floats due to floating-point rounding in the equation low + (high-low) * random_sample(). For example: >>> x = np.float32(5*0.99999999)
>>> x
5.0
 Examples Draw samples from the distribution: >>> s = np.random.uniform(-1,0,1000)
 All values are within the given interval: >>> np.all(s >= -1)
True
>>> np.all(s < 0)
True
 Display the histogram of the samples, along with the probability density function: >>> import matplotlib.pyplot as plt
>>> count, bins, ignored = plt.hist(s, 15, density=True)
>>> plt.plot(bins, np.ones_like(bins), linewidth=2, color='r')
>>> plt.show()
numpy.random.vonmises   random.vonmises(mu, kappa, size=None)
 
Draw samples from a von Mises distribution. Samples are drawn from a von Mises distribution with specified mode (mu) and dispersion (kappa), on the interval [-pi, pi]. The von Mises distribution (also known as the circular normal distribution) is a continuous probability distribution on the unit circle. It may be thought of as the circular analogue of the normal distribution.  Note New code should use the vonmises method of a default_rng() instance instead; please see the Quick Start.   Parameters 
 
mufloat or array_like of floats


Mode (“center”) of the distribution.  
kappafloat or array_like of floats


Dispersion of the distribution, has to be >=0.  
sizeint 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 mu and kappa are both scalars. Otherwise, np.broadcast(mu, kappa).size samples are drawn.    Returns 
 
outndarray or scalar


Drawn samples from the parameterized von Mises distribution.      See also  scipy.stats.vonmises

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

which should be used for new code.    Notes The probability density for the von Mises distribution is  \[p(x) = \frac{e^{\kappa cos(x-\mu)}}{2\pi I_0(\kappa)},\] where \(\mu\) is the mode and \(\kappa\) the dispersion, and \(I_0(\kappa)\) is the modified Bessel function of order 0. The von Mises is named for Richard Edler von Mises, who was born in Austria-Hungary, in what is now the Ukraine. He fled to the United States in 1939 and became a professor at Harvard. He worked in probability theory, aerodynamics, fluid mechanics, and philosophy of science. References  1 
Abramowitz, M. and Stegun, I. A. (Eds.). “Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables, 9th printing,” New York: Dover, 1972.  2 
von Mises, R., “Mathematical Theory of Probability and Statistics”, New York: Academic Press, 1964.   Examples Draw samples from the distribution: >>> mu, kappa = 0.0, 4.0 # mean and dispersion
>>> s = np.random.vonmises(mu, kappa, 1000)
 Display the histogram of the samples, along with the probability density function: >>> import matplotlib.pyplot as plt
>>> from scipy.special import i0  
>>> plt.hist(s, 50, density=True)
>>> x = np.linspace(-np.pi, np.pi, num=51)
>>> y = np.exp(kappa*np.cos(x-mu))/(2*np.pi*i0(kappa))  
>>> plt.plot(x, y, linewidth=2, color='r')  
>>> plt.show()
numpy.random.wald   random.wald(mean, scale, size=None)
 
Draw samples from a Wald, or inverse Gaussian, distribution. As the scale approaches infinity, the distribution becomes more like a Gaussian. Some references claim that the Wald is an inverse Gaussian with mean equal to 1, but this is by no means universal. The inverse Gaussian distribution was first studied in relationship to Brownian motion. In 1956 M.C.K. Tweedie used the name inverse Gaussian because there is an inverse relationship between the time to cover a unit distance and distance covered in unit time.  Note New code should use the wald method of a default_rng() instance instead; please see the Quick Start.   Parameters 
 
meanfloat or array_like of floats


Distribution mean, must be > 0.  
scalefloat or array_like of floats


Scale parameter, must be > 0.  
sizeint 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 mean and scale are both scalars. Otherwise, np.broadcast(mean, scale).size samples are drawn.    Returns 
 
outndarray or scalar


Drawn samples from the parameterized Wald distribution.      See also  Generator.wald

which should be used for new code.    Notes The probability density function for the Wald distribution is  \[P(x;mean,scale) = \sqrt{\frac{scale}{2\pi x^3}}e^ \frac{-scale(x-mean)^2}{2\cdotp mean^2x}\] As noted above the inverse Gaussian distribution first arise from attempts to model Brownian motion. It is also a competitor to the Weibull for use in reliability modeling and modeling stock returns and interest rate processes. References  1 
Brighton Webs Ltd., Wald Distribution, https://web.archive.org/web/20090423014010/http://www.brighton-webs.co.uk:80/distributions/wald.asp  2 
Chhikara, Raj S., and Folks, J. Leroy, “The Inverse Gaussian Distribution: Theory : Methodology, and Applications”, CRC Press, 1988.  3 
Wikipedia, “Inverse Gaussian distribution” https://en.wikipedia.org/wiki/Inverse_Gaussian_distribution   Examples Draw values from the distribution and plot the histogram: >>> import matplotlib.pyplot as plt
>>> h = plt.hist(np.random.wald(3, 2, 100000), bins=200, density=True)
>>> plt.show()
numpy.random.weibull   random.weibull(a, size=None)
 
Draw samples from a Weibull distribution. 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 Quick Start.   Parameters 
 
afloat or array_like of floats


Shape parameter of the distribution. Must be nonnegative.  
sizeint 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 
 
outndarray or scalar


Drawn samples from the parameterized Weibull distribution.      See also  scipy.stats.weibull_max
scipy.stats.weibull_min
scipy.stats.genextreme
gumbel
Generator.weibull

which should be used for new code.    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. References  1 
Waloddi Weibull, Royal Technical University, Stockholm, 1939 “A Statistical Theory Of The Strength Of Materials”, Ingeniorsvetenskapsakademiens Handlingar Nr 151, 1939, Generalstabens Litografiska Anstalts Forlag, Stockholm.  2 
Waloddi Weibull, “A Statistical Distribution Function of Wide Applicability”, Journal Of Applied Mechanics ASME Paper 1951.  3 
Wikipedia, “Weibull distribution”, https://en.wikipedia.org/wiki/Weibull_distribution   Examples Draw samples from the distribution: >>> a = 5. # shape
>>> s = np.random.weibull(a, 1000)
 Display the histogram of the samples, along with the probability density function: >>> import matplotlib.pyplot as plt
>>> x = np.arange(1,100.)/50.
>>> def weib(x,n,a):
...     return (a / n) * (x / n)**(a - 1) * np.exp(-(x / n)**a)
 >>> count, bins, ignored = plt.hist(np.random.weibull(5.,1000))
>>> x = np.arange(1,100.)/50.
>>> scale = count.max()/weib(x, 1., 5.).max()
>>> plt.plot(x, weib(x, 1., 5.)*scale)
>>> plt.show()
numpy.random.zipf   random.zipf(a, size=None)
 
Draw samples from a Zipf distribution. Samples are drawn from a Zipf distribution with specified parameter a > 1. The Zipf distribution (also known as the zeta distribution) is a discrete probability distribution that satisfies Zipf’s law: the frequency of an item is inversely proportional to its rank in a frequency table.  Note New code should use the zipf method of a default_rng() instance instead; please see the Quick Start.   Parameters 
 
afloat or array_like of floats


Distribution parameter. Must be greater than 1.  
sizeint 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 
 
outndarray or scalar


Drawn samples from the parameterized Zipf distribution.      See also  scipy.stats.zipf

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

which should be used for new code.    Notes The probability density for the Zipf distribution is  \[p(k) = \frac{k^{-a}}{\zeta(a)},\] for integers \(k \geq 1\), where \(\zeta\) is the Riemann Zeta function. It is named for the American linguist George Kingsley Zipf, who noted that the frequency of any word in a sample of a language is inversely proportional to its rank in the frequency table. References  1 
Zipf, G. K., “Selected Studies of the Principle of Relative Frequency in Language,” Cambridge, MA: Harvard Univ. Press, 1932.   Examples Draw samples from the distribution: >>> a = 4.0
>>> n = 20000
>>> s = np.random.zipf(a, n)
 Display the histogram of the samples, along with the expected histogram based on the probability density function: >>> import matplotlib.pyplot as plt
>>> from scipy.special import zeta  
 bincount provides a fast histogram for small integers. >>> count = np.bincount(s)
>>> k = np.arange(1, s.max() + 1)
 >>> plt.bar(k, count[1:], alpha=0.5, label='sample count')
>>> plt.plot(k, n*(k**-a)/zeta(a), 'k.-', alpha=0.5,
...          label='expected count')   
>>> plt.semilogy()
>>> plt.grid(alpha=0.4)
>>> plt.legend()
>>> plt.title(f'Zipf sample, a={a}, size={n}')
>>> plt.show()
numpy.recarray.all method   recarray.all(axis=None, out=None, keepdims=False, *, where=True)
 
Returns True if all elements evaluate to True. Refer to numpy.all for full documentation.  See also  numpy.all

equivalent function
numpy.recarray.any method   recarray.any(axis=None, out=None, keepdims=False, *, where=True)
 
Returns True if any of the elements of a evaluate to True. Refer to numpy.any for full documentation.  See also  numpy.any

equivalent function
numpy.recarray.argmax method   recarray.argmax(axis=None, out=None)
 
Return indices of the maximum values along the given axis. Refer to numpy.argmax for full documentation.  See also  numpy.argmax

equivalent function
numpy.recarray.argmin method   recarray.argmin(axis=None, out=None)
 
Return indices of the minimum values along the given axis. Refer to numpy.argmin for detailed documentation.  See also  numpy.argmin

equivalent function
numpy.recarray.argpartition method   recarray.argpartition(kth, axis=- 1, kind='introselect', order=None)
 
Returns the indices that would partition this array. Refer to numpy.argpartition for full documentation.  New in version 1.8.0.   See also  numpy.argpartition

equivalent function
numpy.recarray.argsort method   recarray.argsort(axis=- 1, kind=None, order=None)
 
Returns the indices that would sort this array. Refer to numpy.argsort for full documentation.  See also  numpy.argsort

equivalent function