neulab/docprompting-conala huggingface dataset:
numpy.random.RandomState.standard_normal method   random.RandomState.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.RandomState.triangular method   random.RandomState.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.RandomState.uniform method   random.RandomState.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.RandomState.vonmises method   random.RandomState.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.RandomState.wald method   random.RandomState.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.RandomState.weibull method   random.RandomState.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.RandomState.zipf method   random.RandomState.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.random.ranf   random.ranf()
 
This is an alias of random_sample. See random_sample for the complete documentation.
numpy.random.rayleigh   random.rayleigh(scale=1.0, size=None)
 
Draw samples from a Rayleigh distribution. The \(\chi\) and Weibull distributions are generalizations of the Rayleigh.  Note New code should use the rayleigh method of a default_rng() instance instead; please see the Quick Start.   Parameters 
 
scalefloat or array_like of floats, optional


Scale, also equals the mode. Must be non-negative. Default is 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 scale is a scalar. Otherwise, np.array(scale).size samples are drawn.    Returns 
 
outndarray or scalar


Drawn samples from the parameterized Rayleigh distribution.      See also  Generator.rayleigh

which should be used for new code.    Notes The probability density function for the Rayleigh distribution is  \[P(x;scale) = \frac{x}{scale^2}e^{\frac{-x^2}{2 \cdotp scale^2}}\] The Rayleigh distribution would arise, for example, if the East and North components of the wind velocity had identical zero-mean Gaussian distributions. Then the wind speed would have a Rayleigh distribution. References  1 
Brighton Webs Ltd., “Rayleigh Distribution,” https://web.archive.org/web/20090514091424/http://brighton-webs.co.uk:80/distributions/rayleigh.asp  2 
Wikipedia, “Rayleigh distribution” https://en.wikipedia.org/wiki/Rayleigh_distribution   Examples Draw values from the distribution and plot the histogram >>> from matplotlib.pyplot import hist
>>> values = hist(np.random.rayleigh(3, 100000), bins=200, density=True)
 Wave heights tend to follow a Rayleigh distribution. If the mean wave height is 1 meter, what fraction of waves are likely to be larger than 3 meters? >>> meanvalue = 1
>>> modevalue = np.sqrt(2 / np.pi) * meanvalue
>>> s = np.random.rayleigh(modevalue, 1000000)
 The percentage of waves larger than 3 meters is: >>> 100.*sum(s>3)/1000000.
0.087300000000000003 # random
numpy.random.sample   random.sample()
 
This is an alias of random_sample. See random_sample for the complete documentation.
numpy.random.seed   random.seed(self, seed=None)
 
Reseed a legacy MT19937 BitGenerator Notes This is a convenience, legacy function. The best practice is to not reseed a BitGenerator, rather to recreate a new one. This method is here for legacy reasons. This example demonstrates best practice. >>> from numpy.random import MT19937
>>> from numpy.random import RandomState, SeedSequence
>>> rs = RandomState(MT19937(SeedSequence(123456789)))
# Later, you want to restart the stream
>>> rs = RandomState(MT19937(SeedSequence(987654321)))
numpy.random.SeedSequence.generate_state method   random.SeedSequence.generate_state(n_words, dtype=np.uint32)
 
Return the requested number of words for PRNG seeding. A BitGenerator should call this method in its constructor with an appropriate n_words parameter to properly seed itself.  Parameters 
 
n_wordsint


dtypenp.uint32 or np.uint64, optional


The size of each word. This should only be either uint32 or uint64. Strings (‘uint32’, ‘uint64’) are fine. Note that requesting uint64 will draw twice as many bits as uint32 for the same n_words. This is a convenience for BitGenerator`s that express their states as `uint64 arrays.    Returns 
 
stateuint32 or uint64 array, shape=(n_words,)
numpy.random.SeedSequence.spawn method   random.SeedSequence.spawn(n_children)
 
Spawn a number of child SeedSequence s by extending the spawn_key.  Parameters 
 
n_childrenint

  Returns 
 
seqslist of SeedSequence s
numpy.random.SeedSequence.spawn_key attribute   random.SeedSequence.spawn_key
numpy.random.set_state   random.set_state(state)
 
Set the internal state of the generator from a tuple. For use if one has reason to manually (re-)set the internal state of the bit generator used by the RandomState instance. By default, RandomState uses the “Mersenne Twister”[1] pseudo-random number generating algorithm.  Parameters 
 
state{tuple(str, ndarray of 624 uints, int, int, float), dict}


The state tuple has the following items:  the string ‘MT19937’, specifying the Mersenne Twister algorithm. a 1-D array of 624 unsigned integers keys. an integer pos. an integer has_gauss. a float cached_gaussian.  If state is a dictionary, it is directly set using the BitGenerators state property.    Returns 
 
outNone


Returns ‘None’ on success.      See also  get_state
  Notes set_state and get_state are not needed to work with any of the random distributions in NumPy. If the internal state is manually altered, the user should know exactly what he/she is doing. For backwards compatibility, the form (str, array of 624 uints, int) is also accepted although it is missing some information about the cached Gaussian value: state = ('MT19937', keys, pos). References  1 
M. Matsumoto and T. Nishimura, “Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator,” ACM Trans. on Modeling and Computer Simulation, Vol. 8, No. 1, pp. 3-30, Jan. 1998.
numpy.random.SFC64.cffi attribute   random.SFC64.cffi
 
CFFI interface  Returns 
 
interfacenamedtuple


Named tuple containing CFFI wrapper  state_address - Memory address of the state struct state - pointer to the state struct next_uint64 - function pointer to produce 64 bit integers next_uint32 - function pointer to produce 32 bit integers next_double - function pointer to produce doubles bitgen - pointer to the bit generator struct
numpy.random.SFC64.ctypes attribute   random.SFC64.ctypes
 
ctypes interface  Returns 
 
interfacenamedtuple


Named tuple containing ctypes wrapper  state_address - Memory address of the state struct state - pointer to the state struct next_uint64 - function pointer to produce 64 bit integers next_uint32 - function pointer to produce 32 bit integers next_double - function pointer to produce doubles bitgen - pointer to the bit generator struct
numpy.random.SFC64.state attribute   random.SFC64.state
 
Get or set the PRNG state  Returns 
 
statedict


Dictionary containing the information required to describe the state of the PRNG
numpy.random.shuffle   random.shuffle(x)
 
Modify a sequence in-place by shuffling its contents. This function only shuffles the array along the first axis of a multi-dimensional array. The order of sub-arrays is changed but their contents remains the same.  Note New code should use the shuffle method of a default_rng() instance instead; please see the Quick Start.   Parameters 
 
xndarray or MutableSequence


The array, list or mutable sequence to be shuffled.    Returns 
 None
    See also  Generator.shuffle

which should be used for new code.    Examples >>> arr = np.arange(10)
>>> np.random.shuffle(arr)
>>> arr
[1 7 5 2 9 4 3 6 0 8] # random
 Multi-dimensional arrays are only shuffled along the first axis: >>> arr = np.arange(9).reshape((3, 3))
>>> np.random.shuffle(arr)
>>> arr
array([[3, 4, 5], # random
       [6, 7, 8],
       [0, 1, 2]])