chaospy.create_sobol_samples¶
- chaospy.create_sobol_samples(order, dim, seed=1)[source]¶
Generates samples from the Sobol sequence.
Sobol sequences (also called LP_T sequences or (t, s) sequences in base 2) are an example of quasi-random low-discrepancy sequences. They were first introduced by the Russian mathematician Ilya M. Sobol in 1967.
These sequences use a base of two to form successively finer uniform partitions of the unit interval and then reorder the coordinates in each dimension.
- Args:
- order (int):
Number of unique samples to generate.
- dim (int):
Number of spacial dimensions. Must satisfy
0 < dim < 1111
.- seed (int):
Starting seed. Non-positive values are treated as 1. If omitted, consecutive samples are used.
- Returns:
- (numpy.ndarray):
Quasi-random vector with
shape == (dim, order)
.
- Notes:
Implementation based on the initial work of Sobol [1]. This implementation is based on the work of Burkardt.
- Examples:
>>> distribution = chaospy.Iid(chaospy.Uniform(0, 1), 2) >>> samples = distribution.sample(3, rule="sobol") >>> samples.round(4) array([[0.5 , 0.75, 0.25], [0.5 , 0.25, 0.75]]) >>> samples = distribution.sample(4, rule="sobol") >>> samples.round(4) array([[0.5 , 0.75 , 0.25 , 0.375], [0.5 , 0.25 , 0.75 , 0.375]])