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
ruleflag:———————- ——————————————- key description ———————- ——————————————-
additive_recursionModulus of golden ratio samples.chebyshevRoots of first order Chebyshev polynomials.gridRegular spaced grid.haltonHalton low-discrepancy sequence.hammersleyHammersley low-discrepancy sequence.korobovKorobov lattice.latin_hypercubeLatin hypercube samples.nested_chebyshevChebyshev nodes adjusted to ensure nested.nested_gridNested regular spaced grid.randomClassical (Pseudo-)Random samples.sobolSobol 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 eitherlen(dist) > 1orinclude_axis_dim=True.