chaospy.Distribution.sample

Distribution.sample(size=(), rule='random', antithetic=None, include_axis_dim=False, seed=None)[source]

Create pseudo-random generated samples.

By default, the samples are created using standard (pseudo-)random samples. However, if needed, the samples can also be created by either low-discrepancy sequences, and/or variance reduction techniques.

Changing the sampling scheme, use the following rule flag:

———————- ——————————————- key description ———————- ——————————————- additive_recursion Modulus of golden ratio samples. chebyshev Roots of first order Chebyshev polynomials. grid Regular spaced grid. halton Halton low-discrepancy sequence. hammersley Hammersley low-discrepancy sequence. korobov Korobov lattice. latin_hypercube Latin hypercube samples. nested_chebyshev Chebyshev nodes adjusted to ensure nested. nested_grid Nested regular spaced grid. random Classical (Pseudo-)Random samples. sobol Sobol low-discrepancy sequence. ———————- ——————————————-

All samples are created on the [0, 1]-hypercube, which then is mapped into the domain of the distribution using the inverse Rosenblatt transformation.

Args:
size (numpy.ndarray):

The size of the samples to generate.

rule (str):

Indicator defining the sampling scheme.

antithetic (bool, numpy.ndarray):

If provided, will be used to setup antithetic variables. If array, defines the axes to mirror.

include_axis_dim (bool):

By default an extra dimension even if the number of dimensions is 1.

seed (Optional[int]):

If provided, fixes the random variable’s seed, ensuring reproducible results.

Returns:
(numpy.ndarray):

Random samples with self.shape. An extra dimension might be added to the front if either len(dist) > 1 or include_axis_dim=True.