neulab/docprompting-conala huggingface dataset:
numpy.random.noncentral_f   random.noncentral_f(dfnum, dfden, nonc, size=None)
 
Draw samples from the noncentral F distribution. Samples are drawn from an F distribution with specified parameters, dfnum (degrees of freedom in numerator) and dfden (degrees of freedom in denominator), where both parameters > 1. nonc is the non-centrality parameter.  Note New code should use the noncentral_f method of a default_rng() instance instead; please see the Quick Start.   Parameters 
 
dfnumfloat or array_like of floats


Numerator degrees of freedom, must be > 0.  Changed in version 1.14.0: Earlier NumPy versions required dfnum > 1.   
dfdenfloat or array_like of floats


Denominator degrees of freedom, must be > 0.  
noncfloat or array_like of floats


Non-centrality parameter, the sum of the squares of the numerator means, 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 dfnum, dfden, and nonc are all scalars. Otherwise, np.broadcast(dfnum, dfden, nonc).size samples are drawn.    Returns 
 
outndarray or scalar


Drawn samples from the parameterized noncentral Fisher distribution.      See also  Generator.noncentral_f

which should be used for new code.    Notes When calculating the power of an experiment (power = probability of rejecting the null hypothesis when a specific alternative is true) the non-central F statistic becomes important. When the null hypothesis is true, the F statistic follows a central F distribution. When the null hypothesis is not true, then it follows a non-central F statistic. References  1 
Weisstein, Eric W. “Noncentral F-Distribution.” From MathWorld–A Wolfram Web Resource. http://mathworld.wolfram.com/NoncentralF-Distribution.html  2 
Wikipedia, “Noncentral F-distribution”, https://en.wikipedia.org/wiki/Noncentral_F-distribution   Examples In a study, testing for a specific alternative to the null hypothesis requires use of the Noncentral F distribution. We need to calculate the area in the tail of the distribution that exceeds the value of the F distribution for the null hypothesis. We’ll plot the two probability distributions for comparison. >>> dfnum = 3 # between group deg of freedom
>>> dfden = 20 # within groups degrees of freedom
>>> nonc = 3.0
>>> nc_vals = np.random.noncentral_f(dfnum, dfden, nonc, 1000000)
>>> NF = np.histogram(nc_vals, bins=50, density=True)
>>> c_vals = np.random.f(dfnum, dfden, 1000000)
>>> F = np.histogram(c_vals, bins=50, density=True)
>>> import matplotlib.pyplot as plt
>>> plt.plot(F[1][1:], F[0])
>>> plt.plot(NF[1][1:], NF[0])
>>> plt.show()
numpy.random.normal   random.normal(loc=0.0, scale=1.0, size=None)
 
Draw random samples from a normal (Gaussian) distribution. The probability density function of the normal distribution, first derived by De Moivre and 200 years later by both Gauss and Laplace independently [2], is often called the bell curve because of its characteristic shape (see the example below). The normal distributions occurs often in nature. For example, it describes the commonly occurring distribution of samples influenced by a large number of tiny, random disturbances, each with its own unique distribution [2].  Note New code should use the normal method of a default_rng() instance instead; please see the Quick Start.   Parameters 
 
locfloat or array_like of floats


Mean (“centre”) of the distribution.  
scalefloat or array_like of floats


Standard deviation (spread or “width”) of the distribution. 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 loc and scale are both scalars. Otherwise, np.broadcast(loc, scale).size samples are drawn.    Returns 
 
outndarray or scalar


Drawn samples from the parameterized normal distribution.      See also  scipy.stats.norm

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

which should be used for new code.    Notes The probability density for the Gaussian distribution is  \[p(x) = \frac{1}{\sqrt{ 2 \pi \sigma^2 }} e^{ - \frac{ (x - \mu)^2 } {2 \sigma^2} },\] where \(\mu\) is the mean and \(\sigma\) the standard deviation. The square of the standard deviation, \(\sigma^2\), is called the variance. The function has its peak at the mean, and its “spread” increases with the standard deviation (the function reaches 0.607 times its maximum at \(x + \sigma\) and \(x - \sigma\) [2]). This implies that normal is more likely to return samples lying close to the mean, rather than those far away. References  1 
Wikipedia, “Normal distribution”, https://en.wikipedia.org/wiki/Normal_distribution  
2(1,2,3)
 
P. R. Peebles Jr., “Central Limit Theorem” in “Probability, Random Variables and Random Signal Principles”, 4th ed., 2001, pp. 51, 51, 125.   Examples Draw samples from the distribution: >>> mu, sigma = 0, 0.1 # mean and standard deviation
>>> s = np.random.normal(mu, sigma, 1000)
 Verify the mean and the variance: >>> abs(mu - np.mean(s))
0.0  # may vary
 >>> abs(sigma - np.std(s, ddof=1))
0.1  # may vary
 Display the histogram of the samples, along with the probability density function: >>> import matplotlib.pyplot as plt
>>> count, bins, ignored = plt.hist(s, 30, density=True)
>>> plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) *
...                np.exp( - (bins - mu)**2 / (2 * sigma**2) ),
...          linewidth=2, color='r')
>>> plt.show()
    Two-by-four array of samples from N(3, 6.25): >>> np.random.normal(3, 2.5, size=(2, 4))
array([[-4.49401501,  4.00950034, -1.81814867,  7.29718677],   # random
       [ 0.39924804,  4.68456316,  4.99394529,  4.84057254]])  # random
numpy.random.PCG64.advance method   random.PCG64.advance(delta)
 
Advance the underlying RNG as-if delta draws have occurred.  Parameters 
 
deltainteger, positive


Number of draws to advance the RNG. Must be less than the size state variable in the underlying RNG.    Returns 
 
selfPCG64


RNG advanced delta steps     Notes Advancing a RNG updates the underlying RNG state as-if a given number of calls to the underlying RNG have been made. In general there is not a one-to-one relationship between the number output random values from a particular distribution and the number of draws from the core RNG. This occurs for two reasons:  The random values are simulated using a rejection-based method and so, on average, more than one value from the underlying RNG is required to generate an single draw. The number of bits required to generate a simulated value differs from the number of bits generated by the underlying RNG. For example, two 16-bit integer values can be simulated from a single draw of a 32-bit RNG.  Advancing the RNG state resets any pre-computed random numbers. This is required to ensure exact reproducibility.
numpy.random.PCG64.cffi attribute   random.PCG64.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.PCG64.ctypes attribute   random.PCG64.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.PCG64.jumped method   random.PCG64.jumped(jumps=1)
 
Returns a new bit generator with the state jumped. Jumps the state as-if jumps * 210306068529402873165736369884012333109 random numbers have been generated.  Parameters 
 
jumpsinteger, positive


Number of times to jump the state of the bit generator returned    Returns 
 
bit_generatorPCG64


New instance of generator jumped iter times     Notes The step size is phi-1 when multiplied by 2**128 where phi is the golden ratio.
numpy.random.PCG64.state attribute   random.PCG64.state
 
Get or set the PRNG state  Returns 
 
statedict


Dictionary containing the information required to describe the state of the PRNG
numpy.random.PCG64DXSM.advance method   random.PCG64DXSM.advance(delta)
 
Advance the underlying RNG as-if delta draws have occurred.  Parameters 
 
deltainteger, positive


Number of draws to advance the RNG. Must be less than the size state variable in the underlying RNG.    Returns 
 
selfPCG64


RNG advanced delta steps     Notes Advancing a RNG updates the underlying RNG state as-if a given number of calls to the underlying RNG have been made. In general there is not a one-to-one relationship between the number output random values from a particular distribution and the number of draws from the core RNG. This occurs for two reasons:  The random values are simulated using a rejection-based method and so, on average, more than one value from the underlying RNG is required to generate an single draw. The number of bits required to generate a simulated value differs from the number of bits generated by the underlying RNG. For example, two 16-bit integer values can be simulated from a single draw of a 32-bit RNG.  Advancing the RNG state resets any pre-computed random numbers. This is required to ensure exact reproducibility.
numpy.random.PCG64DXSM.cffi attribute   random.PCG64DXSM.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.PCG64DXSM.ctypes attribute   random.PCG64DXSM.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.PCG64DXSM.jumped method   random.PCG64DXSM.jumped(jumps=1)
 
Returns a new bit generator with the state jumped. Jumps the state as-if jumps * 210306068529402873165736369884012333109 random numbers have been generated.  Parameters 
 
jumpsinteger, positive


Number of times to jump the state of the bit generator returned    Returns 
 
bit_generatorPCG64DXSM


New instance of generator jumped iter times     Notes The step size is phi-1 when multiplied by 2**128 where phi is the golden ratio.
numpy.random.PCG64DXSM.state attribute   random.PCG64DXSM.state
 
Get or set the PRNG state  Returns 
 
statedict


Dictionary containing the information required to describe the state of the PRNG
numpy.random.permutation   random.permutation(x)
 
Randomly permute a sequence, or return a permuted range. If x is a multi-dimensional array, it is only shuffled along its first index.  Note New code should use the permutation method of a default_rng() instance instead; please see the Quick Start.   Parameters 
 
xint or array_like


If x is an integer, randomly permute np.arange(x). If x is an array, make a copy and shuffle the elements randomly.    Returns 
 
outndarray


Permuted sequence or array range.      See also  Generator.permutation

which should be used for new code.    Examples >>> np.random.permutation(10)
array([1, 7, 4, 3, 0, 9, 2, 5, 8, 6]) # random
 >>> np.random.permutation([1, 4, 9, 12, 15])
array([15,  1,  9,  4, 12]) # random
 >>> arr = np.arange(9).reshape((3, 3))
>>> np.random.permutation(arr)
array([[6, 7, 8], # random
       [0, 1, 2],
       [3, 4, 5]])
numpy.random.Philox.advance method   random.Philox.advance(delta)
 
Advance the underlying RNG as-if delta draws have occurred.  Parameters 
 
deltainteger, positive


Number of draws to advance the RNG. Must be less than the size state variable in the underlying RNG.    Returns 
 
selfPhilox


RNG advanced delta steps     Notes Advancing a RNG updates the underlying RNG state as-if a given number of calls to the underlying RNG have been made. In general there is not a one-to-one relationship between the number output random values from a particular distribution and the number of draws from the core RNG. This occurs for two reasons:  The random values are simulated using a rejection-based method and so, on average, more than one value from the underlying RNG is required to generate an single draw. The number of bits required to generate a simulated value differs from the number of bits generated by the underlying RNG. For example, two 16-bit integer values can be simulated from a single draw of a 32-bit RNG.  Advancing the RNG state resets any pre-computed random numbers. This is required to ensure exact reproducibility.
numpy.random.Philox.cffi attribute   random.Philox.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.Philox.ctypes attribute   random.Philox.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.Philox.jumped method   random.Philox.jumped(jumps=1)
 
Returns a new bit generator with the state jumped The state of the returned big generator is jumped as-if 2**(128 * jumps) random numbers have been generated.  Parameters 
 
jumpsinteger, positive


Number of times to jump the state of the bit generator returned    Returns 
 
bit_generatorPhilox


New instance of generator jumped iter times
numpy.random.Philox.state attribute   random.Philox.state
 
Get or set the PRNG state  Returns 
 
statedict


Dictionary containing the information required to describe the state of the PRNG
numpy.random.poisson   random.poisson(lam=1.0, size=None)
 
Draw samples from a Poisson distribution. The Poisson distribution is the limit of the binomial distribution for large N.  Note New code should use the poisson method of a default_rng() instance instead; please see the Quick Start.   Parameters 
 
lamfloat or array_like of floats


Expected number of events occurring in a fixed-time interval, must be >= 0. A sequence must be broadcastable over the requested size.  
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 lam is a scalar. Otherwise, np.array(lam).size samples are drawn.    Returns 
 
outndarray or scalar


Drawn samples from the parameterized Poisson distribution.      See also  Generator.poisson

which should be used for new code.    Notes The Poisson distribution  \[f(k; \lambda)=\frac{\lambda^k e^{-\lambda}}{k!}\] For events with an expected separation \(\lambda\) the Poisson distribution \(f(k; \lambda)\) describes the probability of \(k\) events occurring within the observed interval \(\lambda\). Because the output is limited to the range of the C int64 type, a ValueError is raised when lam is within 10 sigma of the maximum representable value. References  1 
Weisstein, Eric W. “Poisson Distribution.” From MathWorld–A Wolfram Web Resource. http://mathworld.wolfram.com/PoissonDistribution.html  2 
Wikipedia, “Poisson distribution”, https://en.wikipedia.org/wiki/Poisson_distribution   Examples Draw samples from the distribution: >>> import numpy as np
>>> s = np.random.poisson(5, 10000)
 Display histogram of the sample: >>> import matplotlib.pyplot as plt
>>> count, bins, ignored = plt.hist(s, 14, density=True)
>>> plt.show()
    Draw each 100 values for lambda 100 and 500: >>> s = np.random.poisson(lam=(100., 500.), size=(100, 2))
numpy.random.power   random.power(a, size=None)
 
Draws samples in [0, 1] from a power distribution with positive exponent a - 1. Also known as the power function distribution.  Note New code should use the power method of a default_rng() instance instead; please see the Quick Start.   Parameters 
 
afloat or array_like of floats


Parameter of the distribution. 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 a is a scalar. Otherwise, np.array(a).size samples are drawn.    Returns 
 
outndarray or scalar


Drawn samples from the parameterized power distribution.    Raises 
 ValueError

If a <= 0.      See also  Generator.power

which should be used for new code.    Notes The probability density function is  \[P(x; a) = ax^{a-1}, 0 \le x \le 1, a>0.\] The power function distribution is just the inverse of the Pareto distribution. It may also be seen as a special case of the Beta distribution. It is used, for example, in modeling the over-reporting of insurance claims. References  1 
Christian Kleiber, Samuel Kotz, “Statistical size distributions in economics and actuarial sciences”, Wiley, 2003.  2 
Heckert, N. A. and Filliben, James J. “NIST Handbook 148: Dataplot Reference Manual, Volume 2: Let Subcommands and Library Functions”, National Institute of Standards and Technology Handbook Series, June 2003. https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/powpdf.pdf   Examples Draw samples from the distribution: >>> a = 5. # shape
>>> samples = 1000
>>> s = np.random.power(a, samples)
 Display the histogram of the samples, along with the probability density function: >>> import matplotlib.pyplot as plt
>>> count, bins, ignored = plt.hist(s, bins=30)
>>> x = np.linspace(0, 1, 100)
>>> y = a*x**(a-1.)
>>> normed_y = samples*np.diff(bins)[0]*y
>>> plt.plot(x, normed_y)
>>> plt.show()
    Compare the power function distribution to the inverse of the Pareto. >>> from scipy import stats 
>>> rvs = np.random.power(5, 1000000)
>>> rvsp = np.random.pareto(5, 1000000)
>>> xx = np.linspace(0,1,100)
>>> powpdf = stats.powerlaw.pdf(xx,5)  
 >>> plt.figure()
>>> plt.hist(rvs, bins=50, density=True)
>>> plt.plot(xx,powpdf,'r-')  
>>> plt.title('np.random.power(5)')
 >>> plt.figure()
>>> plt.hist(1./(1.+rvsp), bins=50, density=True)
>>> plt.plot(xx,powpdf,'r-')  
>>> plt.title('inverse of 1 + np.random.pareto(5)')
 >>> plt.figure()
>>> plt.hist(1./(1.+rvsp), bins=50, density=True)
>>> plt.plot(xx,powpdf,'r-')  
>>> plt.title('inverse of stats.pareto(5)')
numpy.random.rand   random.rand(d0, d1, ..., dn)
 
Random values in a given shape.  Note This is a convenience function for users porting code from Matlab, and wraps random_sample. That function takes a tuple to specify the size of the output, which is consistent with other NumPy functions like numpy.zeros and numpy.ones.  Create an array of the given shape and populate it with random samples from a uniform distribution over [0, 1).  Parameters 
 
d0, d1, …, dnint, optional


The dimensions of the returned array, must be non-negative. If no argument is given a single Python float is returned.    Returns 
 
outndarray, shape (d0, d1, ..., dn)


Random values.      See also  random
  Examples >>> np.random.rand(3,2)
array([[ 0.14022471,  0.96360618],  #random
       [ 0.37601032,  0.25528411],  #random
       [ 0.49313049,  0.94909878]]) #random
numpy.random.randint   random.randint(low, high=None, size=None, dtype=int)
 
Return random integers from low (inclusive) to high (exclusive). Return random integers from the “discrete uniform” distribution of the specified dtype in the “half-open” interval [low, high). If high is None (the default), then results are from [0, low).  Note New code should use the integers method of a default_rng() instance instead; please see the Quick Start.   Parameters 
 
lowint or array-like of ints


Lowest (signed) integers to be drawn from the distribution (unless high=None, in which case this parameter is one above the highest such integer).  
highint or array-like of ints, optional


If provided, one above the largest (signed) integer to be drawn from the distribution (see above for behavior if high=None). If array-like, must contain integer values  
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.  
dtypedtype, optional


Desired dtype of the result. Byteorder must be native. The default value is int.  New in version 1.11.0.     Returns 
 
outint or ndarray of ints


size-shaped array of random integers from the appropriate distribution, or a single such random int if size not provided.      See also  random_integers

similar to randint, only for the closed interval [low, high], and 1 is the lowest value if high is omitted.  Generator.integers

which should be used for new code.    Examples >>> np.random.randint(2, size=10)
array([1, 0, 0, 0, 1, 1, 0, 0, 1, 0]) # random
>>> np.random.randint(1, size=10)
array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
 Generate a 2 x 4 array of ints between 0 and 4, inclusive: >>> np.random.randint(5, size=(2, 4))
array([[4, 0, 2, 1], # random
       [3, 2, 2, 0]])
 Generate a 1 x 3 array with 3 different upper bounds >>> np.random.randint(1, [3, 5, 10])
array([2, 2, 9]) # random
 Generate a 1 by 3 array with 3 different lower bounds >>> np.random.randint([1, 5, 7], 10)
array([9, 8, 7]) # random
 Generate a 2 by 4 array using broadcasting with dtype of uint8 >>> np.random.randint([1, 3, 5, 7], [[10], [20]], dtype=np.uint8)
array([[ 8,  6,  9,  7], # random
       [ 1, 16,  9, 12]], dtype=uint8)
numpy.random.randn   random.randn(d0, d1, ..., dn)
 
Return a sample (or samples) from the “standard normal” distribution.  Note This is a convenience function for users porting code from Matlab, and wraps standard_normal. That function takes a tuple to specify the size of the output, which is consistent with other NumPy functions like numpy.zeros and numpy.ones.   Note New code should use the standard_normal method of a default_rng() instance instead; please see the Quick Start.  If positive int_like arguments are provided, randn generates an array of shape (d0, d1, ..., dn), filled with random floats sampled from a univariate “normal” (Gaussian) distribution of mean 0 and variance 1. A single float randomly sampled from the distribution is returned if no argument is provided.  Parameters 
 
d0, d1, …, dnint, optional


The dimensions of the returned array, must be non-negative. If no argument is given a single Python float is returned.    Returns 
 
Zndarray or float


A (d0, d1, ..., dn)-shaped array of floating-point samples from the standard normal distribution, or a single such float if no parameters were supplied.      See also  standard_normal

Similar, but takes a tuple as its argument.  normal

Also accepts mu and sigma arguments.  Generator.standard_normal

which should be used for new code.    Notes For random samples from \(N(\mu, \sigma^2)\), use: sigma * np.random.randn(...) + mu Examples >>> np.random.randn()
2.1923875335537315  # random
 Two-by-four array of samples from N(3, 6.25): >>> 3 + 2.5 * np.random.randn(2, 4)
array([[-4.49401501,  4.00950034, -1.81814867,  7.29718677],   # random
       [ 0.39924804,  4.68456316,  4.99394529,  4.84057254]])  # random
numpy.random.random   random.random(size=None)
 
Return random floats in the half-open interval [0.0, 1.0). Alias for random_sample to ease forward-porting to the new random API.